Joined March 2012
·

Bashir Eghbali

Rubyist, Coderwalloholic, Transhumanist at Coderwall
Rubyist, Coderwalloholic, Transhumanist
Coderwall
·
San Francisco, CA
·
·
·

Posted to Coderwall - Markdown Cheat Sheet over 1 year ago

@fuadsaud, @jcrawford we do support code fences ```ruby now. If code is wrapped in a fence no indentation is required. Also if you use @xxx where xxx is a coderwall username, it will link to their profile.

Posted to Create multiple objects in Java. over 1 year ago

Good tip. Probably want to change:

List humans = new ArrayList<Human>();

to

List humans = new ArrayList<Human>(counter);

more efficient because their won't be array reallocation as you go through the loop since size is known.

Posted to New endorse button LOL over 1 year ago

and you can embed them:
endorse

Great tip! really reduces deployment times. Only if I could figure out how to put /assets in .slugignore for heroku deployments where assets will be synced to S3/CDN, that would make life heaven.

Posted to Better git log over 1 year ago

great looking log. I had to wrap it in double quotes:

git config alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
Posted to #protip style... over 1 year ago

Felix, we listened. It's fixed :)

Posted to Coderwall - Markdown Cheat Sheet over 1 year ago

Great reference. another trick is if you select a block of code and press the Tab button it will automatically prepend the 4 needed spaces before every line. happy coding!

Posted to Pretty git commit graph over 1 year ago

I had to use single quotes but works great:

git log --graph --date-order -C -M --pretty=format:'<%h> %ad [%an] %Cgreen%d%Creset %s' --all --date=short
Posted to Getting weather via your command line over 1 year ago

another way (posted on HN):

telnet rainmaker.wunderground.com

gives something like this:

Press Return for menu
or enter 3 letter forecast city code-- SFO
Weather Conditions at 12:56 PM PDT on 17 Oct 2012 for San Francisco, CA.
Temp(F)    Humidity(%)    Wind(mph)    Pressure(in)    Weather
========================================================================
  75          43%         NORTH at 0       29.88      Clear

Forecast for San Francisco, CA
120 PM PDT Wed Oct 17 2012

.Tonight...Clear. Lows in the upper 50s. Southwest winds 5 to
10 mph in the evening...becoming light. 
.Thursday...Sunny. Highs in the mid 70s. Northeast winds around
5 mph...becoming south in the afternoon. 
.Thursday night...Partly cloudy. Patchy fog after midnight. Lows
in the upper 50s. Southwest winds 5 to 10 mph. 
.Friday...Cloudy in the morning then becoming sunny. Patchy fog
in the morning. Highs in the mid 60s to lower 70s. Southwest
winds 5 to 10 mph. 
.Friday night...Mostly clear in the evening then becoming cloudy.
Patchy fog after midnight. Lows in the mid 50s. Southwest winds
around 10 mph. 
.Saturday...Mostly cloudy. Patchy fog. Highs in the lower 60s. 
.Saturday night...Partly cloudy. Lows in the lower 50s. 
.Sunday and Sunday night...Mostly cloudy. Highs in the lower 60s.
   Press Return to continue, M to return to menu, X to exit:  x
Lows in the lower 50s. 
.Monday...Mostly cloudy. A chance of rain. Highs in the upper
50s. 
.Monday night and Tuesday...Rain likely. Lows in the lower 50s.
Highs around 60. 
.Tuesday night and Wednesday...Mostly cloudy. A chance of rain.
Lows in the lower 50s. Highs around 60. 

&&
                 Temperature        /   precipitation

San Francisco    60  75  59  70     /   0   0   0   0 
Ocean Beach      58  74  58  65     /   0   0   0   0 
Posted to Getting weather via your command line over 1 year ago

This is the output I get

bash-3.2$ current_weather
Weather for San Francisco, CA: 
----------------------------
Current temperature: 85.8F (29.9C)

Wednesday: Clear. High of 81F. Winds from the ENE at 5 to 10 mph shifting to the West in the afternoon.

Wednesday Night: Clear. Low of 61F. Winds less than 5 mph.

Thursday: Clear. High of 86F. Winds from the NE at 5 to 10 mph shifting to the WSW in the afternoon.

Thursday Night: Clear. Low of 59F. Winds from the SW at 5 to 10 mph.

Friday: Clear. High of 73F. Winds from the SW at 5 to 10 mph.

Friday Night: Overcast. Low of 61F. Winds from the West at 5 to 10 mph.

Saturday: Partly cloudy in the morning, then clear. High of 66F. Winds from the WNW at 5 to 20 mph.

Saturday Night: Clear. Low of 54F. Winds from the WNW at 10 to 15 mph.

@tomwrong looks like you had initially published the object sizing code. I want to make sure to give you the credit for it:
http://stackoverflow.com/questions/1248302/javascript-object-size/11900218#11900218

Posted to Fire equalizer - PURE CSS over 1 year ago

@timpietrusky @html5web there is a shortcut for indenting code by 4 spaces to enable highlighting: you can select your code segment and press tab, it will automatically add 4 spaces in front of every line in the block

Great tip. Prints in descending order of size the largest tables:

relation | size (data) | tablespace | location
-----------------+-------------------+-----------+----------
public.facts | 247 MB (154 MB data) | |
public.sessions | 177 MB (111 MB data) | |
public.follows | 110 MB (42 MB data) | |
public.user_events | 58 MB (47 MB data) | |
public.skills | 41 MB (31 MB data) | |

Posted to diagnose CPU churn with strace over 1 year ago

Good tip. On mac OSX you can do:

dtruss -p <pid>
Posted to The Shapes of Css over 1 year ago

Looks like duplicate content, first mentioned here:

http://css-tricks.com/examples/ShapesOfCSS/#

Achievements
1,141 Karma
64,404 Total ProTip Views