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. | |
LOGIN_PAGE=http://localhost.dev/users/sign_in | |
curl --cookie-jar cookie_file $LOGIN_PAGE | grep csrf-token | |
2. | |
<meta content="csrf-token" name="csrf-token" /> | |
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
class CarrierStringIO < StringIO | |
def original_filename | |
# the real name does not matter | |
"photo.jpeg" | |
end | |
def content_type | |
"image/jpeg" | |
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
// Use absolute URLs to navigate to anything not in your Router. | |
var openLinkInTab = false; | |
// Only need this for pushState enabled browsers | |
if (Backbone.history && Backbone.history._hasPushState) { | |
$(document).keydown(function(event) { | |
if (event.ctrlKey || event.keyCode === 91) { | |
openLinkInTab = true; |
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
[ | |
{ "keys": ["ctrl+alt+super+d"], "command": "toggle_side_bar" }, | |
{ "keys": ["super+shift+l"], "command": "expand_selection", "args": {"to": "line"} }, | |
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" }, | |
{ "keys": ["super+shift+1"], "command": "focus_group", "args": { "group": 0 } }, | |
{ "keys": ["super+shift+2"], "command": "focus_group", "args": { "group": 1 } }, | |
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} }, | |
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} }, | |
{ "keys": ["command+shift+."], "command": "insert_snippet", "args": {"name": "Packages/User/erb.sublime-snippet"} }, | |
{ "keys": ["ctrl+command+w"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, |
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
{ | |
"auto_complete": false, | |
"auto_match_enabled": false, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/railscasts.tmTheme", | |
"folder_exclude_patterns":[ | |
".svn", | |
".git", | |
".hg", | |
"CVS", |
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
class Product | |
include Mongoid::Document | |
field :price, type: Money | |
end | |
Money.class_eval do | |
# Converts an object of this instance into a database friendly value. | |
def mongoize |
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
@mixin mobile | |
@media (min-device-width: 320px) and (max-device-width: 568px) | |
@content | |
@mixin mobile-portrait | |
@media (min-device-width: 320px) and (max-device-width: 568px) and (orientation:portrait) | |
@content | |
@mixin mobile-landscape | |
@media (min-device-width: 320px) and (max-device-width: 568px) and (orientation:landscape) |
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
# put in config/initializers/filename.rb | |
Rails.application.assets.logger = Logger.new('/dev/null') | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
call_without_quiet_assets(env).tap do | |
Rails.logger.level = previous_level | |
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
module ActiveSupport | |
module Cache | |
class MemCacheStore | |
module Common | |
KEY = 'all_keys' | |
end | |
# Original method from the memcached store. | |
# Only difference is that we modify the key so we support Arrays |