This file contains hidden or 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
def create_article(options = {}) | |
create_and_authenticate_user | |
Article.all.destroy! | |
request(resource(:articles), :method => "POST", | |
:params => { :article => { :title => 'Title', | |
:content => 'Blog post.' }}) | |
end | |
def create_and_authenticate_user | |
User.all.destroy! |
This file contains hidden or 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
module Hancock | |
module Helpers | |
module Merb | |
begin | |
::Merb::Authentication.user_class = User | |
class ::Merb::Authentication | |
def fetch_user(session_user_id) | |
Merb::Authentication.user_class.get(session[:user_id]) |
This file contains hidden or 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 'sinatra' | |
require 'rack/test' | |
module XModule | |
def some_method | |
"x" | |
end | |
end |
This file contains hidden or 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
// original gist from http://gist.github.com/392869 | |
// got a request from a friend to help make this code work | |
// the previous bug was closing the db handle incorrectly in the callbacks | |
// run it like this | |
// // node foo.js | |
// // curl -vv "http://localhost:3000/37signals%20-%20Mark%20Imbriaco.mov" | |
// // curl -vv "http://localhost:3000/37signals%20-%20Mark%20Imbriaco.mov" | |
var kiwi = require('kiwi'), | |
sys = require('sys') |
This file contains hidden or 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 sys = require('sys'), | |
http = require('http'), | |
spawn = require('child_process').spawn | |
function passAll(callback) { | |
callback() | |
} | |
function passAfterRequest(callback) { | |
var node = http.createClient(80, 'nodejs.org'); |
This file contains hidden or 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
# What is the best way to get it to put out a, b, c | |
# without erroring about the superclass. The module | |
# inclusion order should not matter. In other words, | |
# I should be able to include A then B or B then A | |
# and either way all the letters a, b, and c are | |
# printed out (though not necessarily in that exact order) | |
require 'pp' | |
module Z |
This file contains hidden or 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
module Things | |
get '/' do | |
'Hello!' | |
end | |
end | |
module Keister | |
class App < Sinatra::Base | |
include Things |
This file contains hidden or 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.error (err,req,res,next)-> | |
if process.env.RACK_ENV == 'production' | |
hoptoad.key = 'hoptoadkey' | |
hoptoad.notify(err) | |
res.render 'error.ejs', 500 |
This file contains hidden or 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
Note these instructions are all based on the mightyOhm articles. This is a little bit different because I wanted to get alsa sound working (instead of dsp) so that I could overlay effects | |
and background sound simultaneously. | |
What to do | |
========== | |
install mightyohm trx | |
setup network and wireless | |
vi /etc/opkg.conf | |
src/gz snapshots http://192.168.24.104/mightyohm | |
opkg update |
This file contains hidden or 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 fs = require('fs') | |
, path = require('path') | |
, base64 = require('base64') | |
var body = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAKIAeYDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+kxbCMxpmNRGIwRyf9o5OCxyRtzuBfDE5Jzm/b6dA5JVFVwxJKkgEMzsApAUlgOPmBCgqxG4MSsMiGJRuBOFZjwc5Y5PK |
OlderNewer