This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [{:stat1 => 34, :stat2 => 37}, {:stat1 => 45, :stat2 => 78}] | |
total = {} | |
array.each do |element| | |
element.each do |key, val| | |
total[key] ||= 0 | |
total[key] += val | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# This little guy will download and save all the URLs it can find from the file it retrieves from a | |
# given URL. Works awesomely for Apache index pages of lots of image files. Like http://bukk.it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
T.DateOpenedUTC | |
,C.DataContent | |
,T.subject | |
FROM st_Tickets T | |
LEFT JOIN st_CustomDataFieldsInTickets C | |
ON (T.TicketID = C.TicketID) | |
LEFT JOIN ( | |
SELECT <fourth column here>, Tin.TicketID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chuck@chuck:~/Sites/fastfill → ruby-1.9.2-p290@fastfill → master $ brew install memcached | |
==> Installing memcached dependency: libevent | |
==> Downloading http://monkey.org/~provos/libevent-2.0.12-stable.tar.gz | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/libevent/2.0.12 | |
==> make install | |
/usr/local/Cellar/libevent/2.0.12: 47 files, 1.9M, built in 37 seconds | |
==> Installing memcached | |
==> Downloading http://memcached.googlecode.com/files/memcached-1.4.6.tar.gz | |
######################################################################## 100.0% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Just copy and paste the lines below | |
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY! | |
cd `brew --prefix` | |
git ls-files -z | pbcopy | |
rm -rf Cellar | |
bin/brew prune | |
pbpaste | xargs -0 rm | |
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using #collect in this example makes more sense in my head, because it's kinda like Array#join | |
twitter.user_timeline('cwoodcox').tweets.collect do |tweet| | |
"#{tweet.username}: \" #{tweet.text}\"" | |
end | |
# Using #map in this context makes more sense in my head, since we're operating on every element | |
my_stats_array.map do |stat| | |
stat * 2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return $('table#product_stats a').live('ajax:success', function(xhr, response, status) { | |
var row; | |
return row = $(this); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="half-life" | |
# Set to this to use case-sensitive completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make a keyboard shortcut to run a shell script with Alfred or Quicksilver, and point it at | |
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://nodejs.org | |
http://search.npmjs.org/ | |
https://github.com/dannycoates/node-inspector | |
Terminal: | |
brew install node | |
brew install npm | |
Those little guys will make for a beefy compile process, make sure you're plugged in. building the V8 engine from source can take some time. |
OlderNewer