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
| @mixin mobile_bg($file){ | |
| background-image: image-url('mobile/standard/#{$file}'); | |
| @media screen and (-webkit-min-device-pixel-ratio: 2) { | |
| background-image: image-url('mobile/retina/#{$file}'); | |
| background-size: image-width('mobile/standard/#{$file}') image-height('mobile/standard/#{$file}'); | |
| } | |
| } | |
| // Usage |
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
| // If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
| // Then, use underscore's mixin method to extend it with all your other utility methods | |
| // like so: | |
| _.mixin({ | |
| escapeHtml: function () { | |
| return this.replace(/&/g,'&') | |
| .replace(/>/g,'>') | |
| .replace(/</g,'<') | |
| .replace(/"/g,'"') | |
| .replace(/'/g,'''); |
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
| // | |
| // Backbone.Rails.js | |
| // | |
| // Makes Backbone.js play nicely with the default Rails setup, i.e., | |
| // no need to set | |
| // ActiveRecord::Base.include_root_in_json = false | |
| // and build all of your models directly from `params` rather than | |
| // `params[:model]`. | |
| // | |
| // Load this file after backbone.js and before your application JS. |
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 'fileutils' | |
| # upload with: | |
| # curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename | |
| # or just go to http://localhost:4567/user/filename with a browser | |
| get '/:name/:filename' do |