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
require "threaded_collections" | |
threadcount = 2 | |
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] | |
tps = ThreadedCollectionProcessor.new(arr) | |
tps.process(2) { |thread_id, item| puts "Thread #{thread_id} processed item: #{item}" } |
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
def tally(options = {}) | |
find(:all, options_for_tally(options.merge({:order =>"count DESC" }))) | |
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
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]) |
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
Ping:~ Pete$ cd Documents/workspace/teal | |
Ping:teal Pete$ git stash | |
Usage: /usr/local/git/bin/git-stash [ | save | list | show | apply | clear | create ] | |
Ping:teal Pete$ | |
# Hm. I think "pop" is supposed to show up in there somewhere. Let's check git help: | |
Ping:teal Pete$ git help stash | |
GIT-STASH(1) Git Manual GIT-STASH(1) |
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
=== Epic Snow Leopard Upgrayyyyd Guide === | |
Son, you’re now living in the land of 64-bit systems. | |
That means that some of your 32-bit shit is now broken. | |
Not all is lost. | |
== Fixing MySQL weirdness |
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
# This template represents what FasterAgile believes to be the best mix | |
# of components for ab-initio Rails projects. It includes: | |
# Mocks with factory_girl instead of fixtures; cucumber and shoulda; friendly_ids | |
# and canonical links for SEO; HAML and SASS; the Clearance engine; basic sass | |
# and haml starter files; my favorite plugins and initializers; some utility | |
# methods that I always use. | |
# | |
# Run this template like this: | |
# rails <myproject> -m fasteragile.rb | |
# |
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
[pjackson@host]$ cat ~/.ssh/environment | |
ORACLE_BASE="/opt/oracle" | |
ORACLE_HOME="/opt/oracle/product/10.2.0/client_1" | |
DYLD_LIBRARY_PATH=/opt/oracle/product/10.2.0/client_1/lib | |
[pjackson@host]$ sudo grep PermitUser /etc/ssh/sshd_config | |
PermitUserEnvironment yes |
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
git config --global color.diff auto | |
git config --global color.status auto | |
git config --global color.branch auto |
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
# wesbos: | |
# make sure you have Ruby and Rubygems installed | |
# Get the twitter gem with 'gem install twitter' | |
# Then, run irb and type this code | |
Twitter.follower_ids('peteonrails').each { |f| puts Twitter.follower_ids(f).count } | |
# If you'd rather have a total, do this: | |
Twitter.follower_ids('peteonrails').inject { |memo, f| memo += Twitter.follower_ids(f).count } |
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
// For Aaron | |
// You can replace the passed anonymous function with a callback if you'd rather. | |
<script src="/javascripts/prototype.js" type="text/javascript"></script> | |
<script type='text/javascript'> | |
new PeriodicalExecuter(function(pe) { | |
if (!confirm('Want me to annoy you again later?')) | |
pe.stop(); | |
}, 5); |
OlderNewer