Skip to content

Instantly share code, notes, and snippets.

@samsm
samsm / hosts
Created April 26, 2012 20:32
/etc/hosts
# Annoyances
127.0.0.1 meebo.com
127.0.0.1 cim.meebo.com
127.0.0.1 www.meebo.com
127.0.0.1 s.meebocdn.net
127.0.0.1 rd.meebo.com
@samsm
samsm / scale.rake
Created November 29, 2011 15:51
"Auto" Scale Heroku Cedar instances with rake tasks
I think this is a nice option for apps that are mostly used during particular hours and aren't really ready
for a more intense auto-scaling thing. Hirefire (https://github.com/meskyanichi/hirefire) likely does a
lot more, but I didn't really understand how it worked and don't really need something that fancy right now.
I suspect it requires at least one worker itself, but I don't really know.
Add an API key to your app's Heroku config
heroku config:add HEROKU_API_KEY=your_key (from https://api.heroku.com/account )
Add the above rake task. Change 'YOUR-APPS-NAME' to indigo-butterfly-77 or whatever your app's name is.
@samsm
samsm / Transloadit Assembly Test.html
Created April 18, 2011 15:41
A quick way to try out assemblies with Transloadit without any backend support.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Transloadit</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://assets.transloadit.com/js/jquery.transloadit2.js"></script>
<script type="text/javascript">

10 Ways to improve Github Issues

I love the new GitHub issues, here are some ideas to make it perfect, ordered by priority:

  1. I should be able to pick the assignee and milestone via keyboard when creating a new ticket
  2. Keyboard shortcuts should work everywhere. For example when viewing an existing issue, 'c' will not create a new one.
  3. After creating an issue, the assigned user / milestone should be pre-filled when creating the next issue.
  4. When commenting, I should also be able to assign a different user. Right now this deletes my half-typed comment.
  5. When typing the @ symbol to mention somebody, it should auto-complete the name.
  6. This might just be me, but things feel a little sluggish right now, any improvements would be very welcome.
require 'rubygems'
require 'open-uri'
require 'hpricot'
doc = Hpricot(open('http://www.haitisurf.com/dictionary.shtml'))
text_array = (doc/'font').
collect {|elem| elem.to_plain_text }.
delete_if { |txt| txt == '' }.
select {|txt| txt =~ /.+\-.+/ }
@samsm
samsm / file.rb
Created December 28, 2009 01:14
# 1. Install CouchDBX. Fire it up. (OS X only.)
# 2. sudo gem install couchrest json
# 3. Think up a nice keyword.
# 4. irb
require 'couchrest'
require 'open-uri'
require 'json'
database_name = 'twitter-test'
@db = CouchRest.database!("http://127.0.0.1:5984/#{database_name}")
@samsm
samsm / gist:258823
Created December 17, 2009 15:47 — forked from rentpath/gist:258822
app.get '/guess/:who' do
pass unless params[:who] == 'Frank'
"You got me!"
end
app.get '/guess/*' do
"You missed!"
end
We couldn’t find that file to show.
use Rack::If, {:path => /\A\/admin\/mega-admin.*/}, :any, :skip do
use EasyRackOpenID, :allowed_identifiers => ['http://example.com/mega-admin']
end
# If a person goes to /admin/mega-admin and passes that check, they skip this one:
use Rack::If, {:path => /\A\/admin.*/}, :any do
use EasyRackOpenID, :allowed_identifiers => ['http://example.com/admin']
end
run Site.new