This file contains hidden or 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
# here's my latest gem install-fest appropos of nothing | |
# might give you ideas what gems are interesting (self plug included in there) | |
gem install rspec rails nokogiri mysql2 | |
gem install eventmachine watchr rev guard autotest | |
gem install mongoid wirble hirb pry | |
gem install autotest-rails-pure | |
gem install autotest-standalone |
This file contains hidden or 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
watchr -e 'watch("walrus.*\.rb") {|m| system("clear && rspec -c #{m};") }' |
This file contains hidden or 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/env ruby | |
# UPDATE ALL THE THINGS! | |
# go into each all the git projects and do a `git pull` | |
# this is mainly used to update apps which use git to deliver updates | |
# for example, rbenv & vim plugins | |
# change this here thing-o below. use an asterisk glob for a bunch of submodules. | |
projects = %w( |
This file contains hidden or 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
why(do(I(have.to()))): | |
call(functions(in.different())) | |
ways() | |
class NerdRage(selfselfselfself): | |
def _________init___________: | |
i_hate_underscores_in_methods(selfselfself) | |
if _________name__________ == "_______main_______": | |
this_is_a_cool_trick_but_underscores = "sad panda" |
This file contains hidden or 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
list = [1,2,3] # we're cool here, but it's called a list, not an array | |
list.each.do.what.in.the.hell{}||{} do each ||is all||| this magic that goes right? | |
# do something in one line, i don't know what a multi-line lambda is, that's crazy | |
end end end end end endendendend | |
eend end | |
end | |
end | |
This file contains hidden or 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
import *.util**.;;;; | |
import everything.anyway.**.*;;;;; | |
import com.why.is.my.import.a.web.address.backwards.***;;;;;; | |
import this.goes.on.forever.*; | |
@/* documentation method main - | |
* this @should go in a README.md on | |
* GitHub but these @symbols everywhere are cool too | |
* compiling my documentation is totally cool with me | |
****//////@@@@ |
This file contains hidden or 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
# In some situations, methods on objects in irb and pry really aren't there. | |
# Fire up a rails app in pry. Actually, in my case this was a CLI app. | |
# It happens in pry and irb. In rails and outside of rails. | |
# I think the key is the where statement. | |
>> rows = User.where('email is not null') | |
# hit [tab] [tab] after typing 'path' as an example | |
>> rows.first.path |
This file contains hidden or 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
# how can we quickly get to a Hash object from XML? | |
# what's the disadvantages? what do we throw away? | |
# maybe sometimes we want to use nokogiri's xpath and other API methods ... | |
require 'nori' | |
parser = Nori.new( | |
:parser => :nokogiri, | |
:convert_tags_to => lambda { |tag| tag.snakecase.to_sym } | |
) |
This file contains hidden or 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
# I can't believe this works this elegantly. | |
a = [1,2,3,1,3,3,7] | |
# => [1, 2, 3, 1, 3, 3, 7] | |
a.reject.with_index {|element, i| i < 3} | |
# => [1, 3, 3, 7] |
This file contains hidden or 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
--------------------------------------------------------------------------------------------------- | |
Summary | |
--------------------------------------------------------------------------------------------------- | |
(PL = pipelined redis operation) | |
Loading one million random names (full names) like John Smith, Patty Gerbee Sr) | |
MySQL: 06:05 | |
Redis: 02:45 | |
Redis C ext 01:32 | |
Redis pipelined: 00:56 |