Skip to content

Instantly share code, notes, and snippets.

class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@stream7
stream7 / rails_symbolic_status_codes
Created September 28, 2012 10:15
Rails symbolic status codes
Status Code Status Message Symbol
1xx Informational
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing
2xx Success
@stream7
stream7 / a.md
Created December 16, 2012 20:15 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
@stream7
stream7 / gist:5300987
Created April 3, 2013 12:57
npm install -g generator-backbone-amd
15:55 ~ $ npm install -g generator-backbone-amd
npm http GET https://registry.npmjs.org/generator-backbone-amd
npm http 304 https://registry.npmjs.org/generator-backbone-amd
npm http GET https://registry.npmjs.org/generator-backbone-amd/-/generator-backbone-amd-0.0.2.tgz
npm http 200 https://registry.npmjs.org/generator-backbone-amd/-/generator-backbone-amd-0.0.2.tgz
npm ERR! tar pack Error reading /var/folders/qy/kkl925690s50nmkmc6xls8040000gn/T/npm-5823/1364993719396-0.3919644276611507/package
npm ERR! TypeError: Cannot call method 'filter' of undefined
npm ERR! at Packer.IgnoreReader.addIgnoreRules (/Users/niko/.nvm/v0.8.22/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:148:13)
npm ERR! at Packer.IgnoreReader.addIgnoreFile (/Users/niko/.nvm/v0.8.22/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:133:10)
npm ERR! at fs.readFile (fs.js:176:14)
@stream7
stream7 / main.js
Created April 10, 2013 15:48
main.js
require.config({
paths: {
jquery: '../components/jquery/jquery',
backbone: '../components/backbone/backbone',
underscore: '../components/underscore/underscore',
handlebars: '../components/handlebars/handlebars',
cookie: 'vendor/jquery.cookie',
routefilter: 'vendor/backbone.routefilter',
text: '../components/requirejs-text/text'
},
@stream7
stream7 / gist:5671932
Created May 29, 2013 17:05
bitbucket exception
$ git push --force
Counting objects: 375, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (274/274), done.
Writing objects: 100% (277/277), 47.32 KiB, done.
Total 277 (delta 199), reused 0 (delta 0)
remote: Traceback (most recent call last):
remote: File "/opt/python/domains/bitbucket.org/current/bitbucket/scripts/git/hooks/pre-receive", line 29, in <module>
remote: from bitbucket.apps.repo2.hooks import prehooks
remote: File "/opt/python/domains/bitbucket.org/current/bitbucket/apps/repo2/hooks.py", line 16, in <module>
@stream7
stream7 / dabblet.css
Created July 12, 2013 20:39 — forked from LeaVerou/dabblet.css
Flexible buttons with ems (duh!)
/**
* Flexible buttons with ems (duh!)
*/
body {
font-family: sans-serif
}
button {
padding: .5em .8em .4em;
@stream7
stream7 / toUpperCase Greek
Last active December 22, 2015 20:09
toUpperCase for Greek chars
/*global define*/
'use strict';
define(function () {
var map = {
'ά': 'A',
'Ά': 'Α',
'έ': 'Ε',
'Έ': 'Ε',
'ή': 'Η',
'Ή': 'Η',
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
#
# Update 2013-06-24: added -w0 option to prevent truncated lines
require 'base64'
data=`ioreg -l -w0 -d0 -r -c AppleDisplay`
@stream7
stream7 / gist:4e0037fa497664987455cdb48aff9de9
Created April 3, 2016 08:07
wget commands for downloading a whole website
// Get the pages
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--no-parent \
--restrict-file-names=nocontrol \