Skip to content

Instantly share code, notes, and snippets.

View arockwell's full-sized avatar

Alex Rockwell arockwell

View GitHub Profile
@arockwell
arockwell / Rakefile
Created July 7, 2011 13:52
Simple example of dynamically defining rake tasks
# Put this in a file called Rakefile
# To see all tasks:
# rake -T
# To run a task:
# rake task_a
my_tasks = [ "a", "b", "c" ]
my_tasks.each do |task|
desc "task a"
task "task_#{task}".intern do
puts task
@arockwell
arockwell / rewrite_rdf.py
Created July 15, 2011 20:47
Concatenating rdf/xml files together into one ntriple
#!/usr/bin/python
from rdflib import Graph
import os
path="rdf"
dirList=os.listdir(path)
for fname in dirList:
g = Graph()
g.parse("rdf/" + str(fname))
@arockwell
arockwell / app.coffee
Created May 7, 2012 23:28
blpop in node
count = 0
watch_redis = ->
console.log("inside watch_redis")
redis.blpop "test", 0, (err, data) ->
count = count + 1
redis.lpush "tset", count
console.log("We pushed something! #{count}")
process.nextTick(watch_redis)
watch_redis()
@arockwell
arockwell / app.coffee
Created May 8, 2012 01:00
node redis proof of concept
watch_redis = ->
redis.blpop "test", 0, (err, data) ->
noti = JSON.parse(data[1])
console.log("message: #{noti.message} device_ids: {noti.device_ids}")
apnsSend(noti.message, noti.device_ids)
process.nextTick(watch_redis)
watch_redis()
apnsOptions = {
cert: '/Users/arockwell/dev/node_push_notification/apns-teamstream-dev-cert.pem',
@arockwell
arockwell / gist:2713095
Created May 16, 2012 19:05
merge_users
User.reflect_on_all_associations.each do |assoc|
puts "Processing class: #{assoc.klass}"
collection = merge_in_user.send(assoc.name)
user.send(assoc.name) = user.send(assoc.name) + collection
user.save
merge_in_user.send(assoc.name).clear
end
merge_in_user.delete
undefined local variable or method `flush_writes' for #<Paperclip::Attachment:0x1303a9130>
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip/attachment.rb:175:in `save'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:361:in `send'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:361:in `save_attached_files'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:354:in `each_attachment'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:353:in `each'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:353:in `each_attachment'
/Users/arockwell/dev/breport/vendor/plugins/paperclip/lib/paperclip.rb:360:in `save_attached_files'
/Users/arockwell/.rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `send'
/Users/arockwell/.rvm/gems/ree-1.8.7-2011.03/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:178:in `evaluate_method'
@arockwell
arockwell / gist:2764384
Created May 21, 2012 20:16
Syntax checking br
breport (rc-8274-8111-facebook-edge-case) $ find . -name "*.rb" -type f -print0 | xargs -0 -I file ruby -c file > blarg.txt
./vendor/plugins/rspec_rails/generators/rspec_controller/templates/controller_spec.rb:10: syntax error, unexpected tIDENTIFIER, expecting $end
it "should use <%= class_name %>Controller" do
^
./vendor/plugins/rspec_rails/generators/rspec_controller/templates/helper_spec.rb:7: syntax error, unexpected '(', expecting $end
included_modules = (class << helper; self; end).se...
^
./vendor/plugins/rspec_rails/generators/rspec_model/templates/model_spec.rb:5: syntax error, unexpected '{', expecting $end
./vendor/plugins/rspec_rails/generators/rspec_scaffold/templates/controller_spec.rb:5: syntax error, unexpected tIDENTIFIER, expecting $end
def mock_<%= file_name %>(stubs={})
breport (rc) $ gitc branch http://bleacherreport.lighthouseapp.com/projects/6296/tickets/8194-facebook-remove-old-facebook-js
Your work will eventually merge into 'rc'. Is this correct? (y/n)
y
Retrieving branch information from gitcycle.
Would you like to name your branch 'rc-8274-8194-facebook-remove-old'? (y/n)
n
breport (rc-8194-facebook-remove-old) $ git merge rc-8274-8194-facebook-remove-old
Removing public/javascripts/common/facebook/sign_up_basic.js
Removing public/javascripts/common/facebook/sign_up.js
Removing public/javascripts/common/facebook/sidebar.js
Removing public/javascripts/common/facebook/publish.js
Removing public/javascripts/common/facebook/connect.js
Removing public/javascripts/common/facebook/comments.js
Removing public/javascripts/common/facebook/application.js
Auto-merging config/assets.yml
Auto-merging app/models/tag/notifications.rb
breport (rc-8194-facebook-remove-old) $ git checkout rc
Switched to branch 'rc'
breport (rc) $ git branch -D rc-8194-facebook-remove-old
Deleted branch rc-8194-facebook-remove-old (was f08efc3).
breport (rc) $ git st
# On branch rc
nothing to commit (working directory clean)
breport (rc) $ gitc branch https://bleacherreport.lighthouseapp.com/projects/6296/tickets/8194-facebook-remove-old-facebook-js