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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#!/bin/sh | |
read -r -p "Confirm deployment to PRODUCTION? Type 'yes' to continue " response | |
if [[ $response == "yes" ]] | |
then | |
# Precompile assets and commit to github | |
bundle exec rake assets:precompile RAILS_ENV=production | |
git add . | |
git commit -m 'recompiling assets' | |
git push origin master | |
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 "time" | |
require "date" | |
class Date | |
def to_time | |
Time.local(year, month, day) | |
end | |
end | |
class Time |
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 Admin::ResourceController < Admin::BaseController | |
before_action :load_resource | |
def index | |
respond_with @collection | |
end | |
def edit | |
respond_with(:admin, @object) | |
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
/Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:199:in `block in non_options': file not found: db:prepare_template (ArgumentError) | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:178:in `map!' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:178:in `non_options' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:237:in `non_options' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:58:in `process_args' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1073:in `_run' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/minitest/unit.rb:1066:in `run' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:27:in `run' | |
from /Users/benoit/.rbenv/versions/2.1.0/lib/ruby/2.1.0/test/unit.rb:780:in `run' |
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 'spec_helper' | |
describe "Reset Password" do | |
it "should allow the user to indicate they have forgotten their password" do | |
visit spree.login_path | |
click_link "Forgot Password?" | |
page.should have_content("your password will be emailed to you") | |
end | |
it "should allow a user to supply an email for the password reset" do |
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
# FATAL: lock file "postmaster.pid" already exists | |
# HINT: Is another postmaster (PID 4646) running in data directory "/usr/local/var/postgres"? | |
# To fix this: | |
cat /usr/local/var/postgres/postmaster.pid # pid is the number on first line | |
kill -9 1116 # replace 1116 with pid number (first line) from postmaster.pid file | |
# Or |
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
$(document).ready(function() { | |
// Support for AJAX loaded modal window. | |
// Focuses on first input textbox after it loads the window. | |
$('[data-toggle="modal"]').click(function(e) { | |
e.preventDefault(); | |
var url = $(this).attr('href'); | |
if (url.indexOf('#') == 0) { | |
$(url).modal('open'); | |
} else { |
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 Post < ActiveRecord::Base | |
attr_accessible :body, :price, :title | |
validates_presence_of :title | |
validates_length_of :title, minimum: 10 | |
validates_presence_of :body | |
validates_numericality_of :price, greater_than: 0 | |
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
class Post < ActiveRecord::Base | |
attr_accessible :body, :price, :title | |
validates_presence_of :title | |
validates_length_of :title, minimum: 10 | |
validates_presence_of :body | |
validates_numericality_of :price, greater_than: 0 | |
end |
OlderNewer