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
use Rack::If, {:path => /\A\/admin\/mega-admin.*/}, :any do | |
use EasyRackOpenID, :allowed_identifiers => ['http://example.com/mega-admin'] | |
end | |
use Rack::If, {:path => /\A\/admin.*/}, :any do | |
use EasyRackOpenID, :allowed_identifiers => ['http://example.com/admin'] | |
end | |
run Site.new |
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
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 |
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
app.get '/guess/:who' do | |
pass unless params[:who] == 'Frank' | |
"You got me!" | |
end | |
app.get '/guess/*' do | |
"You missed!" | |
end |
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. 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}") |
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
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 =~ /.+\-.+/ } |
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
I love the new GitHub issues, here are some ideas to make it perfect, ordered by priority:
- I should be able to pick the assignee and milestone via keyboard when creating a new ticket
- Keyboard shortcuts should work everywhere. For example when viewing an existing issue, 'c' will not create a new one.
- After creating an issue, the assigned user / milestone should be pre-filled when creating the next issue.
- When commenting, I should also be able to assign a different user. Right now this deletes my half-typed comment.
- When typing the @ symbol to mention somebody, it should auto-complete the name.
- This might just be me, but things feel a little sluggish right now, any improvements would be very welcome.
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
<!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"> | |
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
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. |
OlderNewer