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
local mongrel2 = require 'mongrel2' | |
local sender_id = '558c92aa-1644-4e24-a524-39baad0f8e78' | |
local sub_addr = 'tcp://127.0.0.1:8989' | |
local pub_addr = 'tcp://127.0.0.1:8988' | |
local io_threads = 1 | |
local response_string = [[ | |
<pre> | |
SENDER: %s |
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
var nodenatra = require('./nodenatra'); | |
app = new nodenatra.App(); | |
app.get('/', function() { | |
return "Hello"; | |
}); | |
app.get('/posts', function() { | |
return "Hey there!"; | |
}); |
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 is a mixin that will be applied to a `fieldset.row`. | |
// `this` in these functions will refer to a $("fieldset.row"). | |
// Put your long complicated functions here | |
var Row = { | |
$name: function() { | |
return this.find('input[name=name]'); | |
}, | |
changeName: function(value) { | |
this.$name().val(value); |
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
career move |
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
(1..100).each {|i| puts [i,[("Fizz"\ | |
if i%3 ==0) ,("Buzz"\ | |
if i%5.0000 ==0) ].join\ | |
('')]. join ("\n")}#FizzBuzz# |
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
# ... assuming this code is at an instance level of your `Ohm::Model` | |
keys = ["set1", "set2"] | |
# previously... | |
db.sunionstore(key(:sorted_position_tags), *keys) | |
# now | |
key[:sorted_position_tags].sunionstore(*keys) |
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
Person.key(:custom) # previous version | |
Person.key[:custom] # new version | |
# At this point it doesn't seem ground breaking, but when we want to do | |
# operations on it, the change will be more apparent. | |
# Code like this: | |
Person.db.sadd Person.key(:my_custom_set), 1 | |
# will be much cleaner, and now look like: |
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
# doing class level key operations | |
Person.key[:top_voted].zadd 10, 1 # ZADD Person:top_voted 10 1 | |
Person.key[:top_voted].zadd 11, 2 # ZADD Person:top_voted 11 2 |
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
all = Person.all | |
all.sort_by(:first_name) | |
created = all.find(creator_id: 1) | |
limited = created.find(contact_details_id: 30) |
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
desc "Pull master from site, minify, and restart thin" | |
task :deploy do | |
cmds = [].tap do |cmd| | |
cmd.push 'git pull' | |
cmd.push 'thin -C config/thin.yml restart' | |
cmd.push 'MINIFY_SITE_URL=http://leafpile.sinefunc.com rake minify' | |
end | |
cmds.each do |cmd| | |
puts "-----> #{cmd}" |