- Install stud
$ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
- Download and install the powssl script
$ curl https://raw.github.com/gist/2050941/3ea59efe8c7e9013c265313045a9fdda5c653963/powssl > ~/bin/powssl
$ chmod +x ~/bin/powssl
- Run powssl to create development certificate and configure stud.
$ powssl
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
[1] pry(#<NotificationCreationService>)> record | |
=> #<Item id: 58, kind: 1, user_id: 79, community_id: 43, category_id: nil, root_category_id: nil, title: "Autem optio molestias unde laudantium fugit officii...", description: "Aut at quod officiis repellendus. Expedita pariatur...", price: nil, original_price: nil, lowest_price: nil, price_drop_count: 0, for_sale: nil, status: nil, bump_position: 1029, published_at: "2012-09-22 17:48:13", last_bumped_at: "2012-09-23 17:48:13", deleted_at: nil, created_at: "2012-09-22 17:48:13", updated_at: "2012-10-02 17:48:13"> | |
[2] pry(#<NotificationCreationService>)> record.is_a?(Item) | |
=> false | |
[3] pry(#<NotificationCreationService>)> record.class.name | |
=> "Item" | |
[4] pry(#<NotificationCreationService>)> record.class | |
=> Item(id: integer, kind: integer, user_id: integer, community_id: integer, category_id: integer, root_category_id: integer, title: string, description: string, price: decimal, original_price: decimal, lowest_price: decimal, price_drop_count: integer, for_sale: b |
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
class ApplicationController < ActionController::Base | |
TOKEN_PLACEHOLDER = "__CROSS_SITE_REQUEST_FORGERY_PROTECTION_TOKEN__" | |
after_filter :inject_csrf_token | |
private | |
def inject_csrf_token | |
if protect_against_forgery? && token = session['_csrf_token'] | |
if body_with_token = response.body.gsub!(TOKEN_PLACEHOLDER, token) |
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
# Set your full path to application. | |
app_path = "/Users/carl/Dropbox/code/web" # -> changed for development env | |
# Set unicorn options | |
worker_processes 20 | |
preload_app true | |
timeout 180 | |
listen 8080 #"/tmp/.unicorn.sock" -> changed for development env | |
# Spawn unicorn master worker for user apps (group: apps) |
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
<html> | |
<head> | |
<title></title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<ul></ul> | |
<p data-foo='abc'></p> | |
<script> |
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
<html> | |
<head> | |
<title></title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
</head> | |
<body> | |
<ul></ul> | |
<p data-foo='abc'></p> | |
<script> |
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
Sam John sent you a message on Quora | |
Sam John said: | |
"Greetings to you and your family, | |
my came is Barr. Samora Johnson. I’m personal Attorney to late (Mr Victor .A. Mercier)a nationality of your country, who bear the same surname with yours. died in heart attack after the death of his wifi and only daughter in a car accident, in Benin Republic West Africa on 21st April 2008. (May their gentle souls rest in perfect peace) without anyone to claim his Fund.USD12.5M deposit in the Security bank. | |
The Bank has issued me an ultimatum to present the next-of-kin of the deceased to inherit the funds to my late client; I have made several enquiries to your embassy here to locate any of my clients extended relatives in his home country, | |
I decided to contact you hence I know that you bear the same surname with him. |
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 foo | |
# do something here | |
end | |
# Is it considered bad practice to assign a variable in a conditional statement? | |
# Ruby gives me a warning: "warning: found = in conditional, should be ==" | |
if x = foo | |
puts x.to_s | |
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
# app/views/users/_user.json.jbuilder | |
json.(user, :id, :name, :age, :gender) |
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(typeof(console) === 'undefined') { | |
var console = {}; | |
console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = function() {}; | |
} |