Skip to content

Instantly share code, notes, and snippets.

export const config = {
intent: ['bitcoin price']
}
export default function *(q) {
const url = 'https://api.coinbase.com/v2/prices/spot?currency=USD'
const result = yield q.http.get(url)
yield q.tell(`bitcoin (${result.data.currency}): $${result.data.amount}`)
return result.data.amount
@mdeiters
mdeiters / Gemfile
Created April 9, 2012 14:50 — forked from itzki/Gemfile
follow from coderwall leaderboard
source "https://rubygems.org"
gem 'mechanize'
gem 'twitter'
@mdeiters
mdeiters / apology101.markdown
Created March 22, 2012 17:53 — forked from avdi/apology101.markdown
How to apologize

Chances are your head's spinning right now. That accusation of bias caught you off guard, you got kind of defensive, and now all hell has broken loose. You're feeling attacked on all sides. You're a good person at heart, and having all these people treat you like the antichrist is pretty upsetting.

You need to say something, but you're probably not in the best headspace to write copy right now. So to help you along, here's my 100% guaranteed-or-you-money-back scandal defusement apology template:

expires_in 1.minute, :public => true if Rails.env.production?
if stale?(:etag => @user.endorsements.size, :last_modified => @user.updated_at.utc)
#...image generation
end
@mdeiters
mdeiters / Gemfile
Created January 16, 2012 20:23
Adding RMagick image manipulation to a Rails 3 project
gem "rmagick", "2.12.0", :require => 'RMagick'
@mdeiters
mdeiters / routes.rb
Created January 16, 2012 20:21
Adding route for PNG generation to controller
match '/:username/endorsecount.png' => 'endorsements#show', :as => :user_endorsement
@mdeiters
mdeiters / gist:1622524
Created January 16, 2012 19:30
Adding text to a PNG in RMagick
image = Magick::Image.read(image_path).first
gc = Magick::Draw.new
gc.stroke('transparent')
gc.fill('#202123')
gc.pointsize('11')
gc.font_family = "helvetica"
gc.font_weight = Magick::BoldWeight
gc.font_style = Magick::NormalStyle
gc.text(x = 83, y = 14, text = user.endorsements.size.to_s)
gc.draw(image)
@mdeiters
mdeiters / embed.html
Created January 16, 2012 07:35
Embedding an endorse button in html, textile, or markdown
<a href="http://coderwall.com/mdeiters">
<img src="http://api.coderwall.com/mdeiters/endorsecount.png" />
</a>
@mdeiters
mdeiters / about.md
Created August 9, 2011 14:21 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@mdeiters
mdeiters / gist:1120324
Created August 2, 2011 14:40 — forked from fhwang/gist:1120210
Git pre-commit hook for JSHint and Rails
#!/usr/bin/env ruby
# To use this:
# * Set up the jshint Gem with your Rails app: https://github.com/liquid/jshint_on_rails
# * Copy this file to [YOURPROJECT]/.git/hooks/pre-commit
# * chmod 0755 .git/hooks/pre-commit
files_changed = `git diff --name-only HEAD`
if files_changed.any? { |line| line =~ %r|public/javascripts| }
puts "Running jshint to check changes to javascript ..."