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
Sequel.migration do | |
up do | |
run 'CREATE EXTENSION "uuid-ossp"' | |
create_table :products do | |
primary_key :id, {type: :uuid, default: Sequel.function(:uuid_generate_v4)} | |
end | |
end | |
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
require 'rubygems' | |
require 'rake' | |
require 'rake/testtask' | |
Rake::TestTask.new do |t| | |
t.pattern = "test/test_*.rb" | |
t.verbose = true | |
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
root@uxtemple:~/tmp/libuv# sh autogen.sh | |
+ libtoolize | |
libtoolize: putting auxiliary files in `.'. | |
libtoolize: linking file `./ltmain.sh' | |
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. | |
libtoolize: linking file `m4/libtool.m4' | |
libtoolize: linking file `m4/ltoptions.m4' | |
libtoolize: linking file `m4/ltsugar.m4' | |
libtoolize: linking file `m4/ltversion.m4' | |
libtoolize: linking file `m4/lt~obsolete.m4' |
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.controllers do | |
get :images, map: '/images/:id/*', provides: ['.jpeg', '.jpg', '.png', '.gif'] do | |
# params[:splat] still contains whatever is entered at the end | |
artwork = Artwork[params[:id]] | |
send_file artwork.picture.tempfile, type: artwork.type | |
end | |
error Mongoid::Errors::MongoidError do | |
halt 404, 'File not found' | |
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
// Originally used to retarget GitHub's embedded gist links to open in a new window. | |
!function() { | |
'use strict'; | |
window.retargetLinks = function() { | |
var gists = document.getElementsByClassName('gist'); | |
for (var i=0, links; i < gists.length; i++) { | |
links = gists[i].getElementsByTagName('a'); | |
for (var j=0; j < links.length; j++) { |
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
def date_field_tag(name, options={}) | |
input_tag(:date, { :name => name }.update(options)) | |
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
# config/boot.rb | |
# Add | |
# load File.expand_path('../bundler-mem.rb', __FILE__) | |
# before Bundler.require(:default, RACK_ENV) | |
# Defines our constants | |
RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV) | |
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT) | |
# Load our dependencies |
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
{ | |
"name": "my-app", | |
"version": "0.0.1", | |
"dependencies": { | |
"normalize-css": "latest", | |
"angular": "latest" | |
} | |
} |
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
{ | |
"name": "rce", | |
"version": "0.0.1", | |
"description": "HMH's RCE", | |
"main": "js/rce.js", | |
"readme": "README.md", | |
"dependencies": { | |
"http-server": "^0.7.4", | |
"react": "^0.12.2" | |
}, |
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
Array.prototype.forEach.apply( | |
document.querySelectorAll('#wikiArticle ul li'), | |
function(li) { | |
var title = document.createElement('div'); | |
title.innerText = li.querySelector('a').title; | |
li.appendChild(title); | |
}); |
OlderNewer