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
| # cap web:deploy:desable & cap web:deploy:enable | |
| server { | |
| ... | |
| if (-f $document_root/system/maintenance.html) { set $maintenance 1; } | |
| if ($request_uri ~* (jpg|jpeg|gif|js|css)$) { set $maintenance 0; } | |
| if ($maintenance) { rewrite ^(.*)$ /system/maintenance.html; break; } | |
| ... | |
| } |
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 tip(msg); puts; puts msg; puts "-"*100; end | |
| # | |
| # 30 Ruby 1.9 Tips, Tricks & Features: | |
| # http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
| # | |
| tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
| tip "Ruby 1.9 supports named captures in regular expressions!" |
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 'resque/tasks' | |
| task "resque:setup" => :environment | |
| namespace :queue do | |
| task :start => :environment do | |
| pidfile = Rails.root.join('tmp', 'pids', 'resque.pid') | |
| logfile = Rails.root.join('log', 'resque.log') | |
| errlogfile = Rails.root.join('log', 'resque_errors.log') |
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
| # Shoulda activemodel cheatsheet | |
| # DB | |
| should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false) | |
| should have_db_index(:email).unique(:true) | |
| # Associations | |
| should belong_to :company | |
| should have_one(:profile).dependent(:destroy) | |
| should have_many(:posts).dependent(:nullify) |
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
| # Core | |
| class Object | |
| def should(matcher) | |
| puts matcher.match(self) | |
| end | |
| end | |
| class Matcher | |
| def initialize(expected, &block) | |
| @expected = expected |
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
| [BUG] Segmentation fault | |
| ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
| -- Control frame information ----------------------------------------------- | |
| c:0007 p:---- s:0021 b:0021 l:000020 d:000020 CFUNC :next! | |
| c:0006 p:0049 s:0018 b:0018 l:000017 d:000017 METHOD /Users/ptico/.rvm/gems/ruby-1.9.3-p0/gems/data_objects-0.10.7/lib/data_objects/reader.rb:35 | |
| c:0005 p:---- s:0014 b:0014 l:000013 d:000013 FINISH | |
| c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :to_a | |
| c:0003 p:0087 s:0009 b:0008 l:001638 d:002478 EVAL do.rb:8 | |
| c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH |
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
| var Baby = (function() { | |
| function Baby(name) { // Constructor | |
| this.name = name; | |
| } | |
| Baby.prototype = { // Public | |
| introduce: function() { | |
| alert("Hello! My name is " + name); | |
| }, | |
| play: function() { |
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 = {}; | |
| // Another sandbox functions | |
| /** | |
| * Creates namespace in sandbox by string definition | |
| * If part of namespace already defined - keep it untouchable, | |
| * else - create empty object. | |
| * | |
| * App.namespace("Hello.World"); |
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
| var Hello = Class({ | |
| attrReader: "val", | |
| initialize: function(val) { | |
| this.val = val; | |
| }, | |
| publicFn: function() { | |
| console.log(this.val); | |
| this.privateFn(); |
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
| define(["bee/widget", "app/models/transport", "app/modules/cargo-log"], function(Widget, Transport, CargoLog) { | |
| "use strict"; | |
| var Transports = new Widget({ | |
| root: "#transports-sidebar", | |
| extends: [CargoLog], | |
| init: function() { | |
| this.transports = []; |
OlderNewer