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
| module ArelScopes | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Create chainable arel scopes | |
| # Example: | |
| # class Post | |
| # arel_scope :published, lambda { arel_table[:published_at].gteq(Time.now) } | |
| # arel_scope :written_by, lambda { |user| arel_table[:author_id].eq(user.id) } |
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
| Rake::Task['assets:precompile'].clear | |
| namespace :assets do | |
| desc "Compile all the assets named in config.assets.precompile" | |
| task :precompile do | |
| # We need to do this dance because RAILS_GROUPS is used | |
| # too early in the boot process and changing here is already too late. | |
| if ENV["RAILS_GROUPS"].to_s.empty? || ENV["RAILS_ENV"].to_s.empty? | |
| ENV["RAILS_GROUPS"] ||= "assets" |
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
| body { | |
| white-space: pre; | |
| font-family: monospace; | |
| font-family: inconsolata; | |
| background: #042029; | |
| color: #819090; | |
| } | |
| .property { | |
| font-weight: normal; |
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
| src_files: | |
| - public/javascripts/lib/jquery/jquery.js | |
| # jammit_packages | |
| # | |
| # See jasmine_config.rb | |
| jammit_packages: | |
| - head | |
| - common |
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
| # config/initializers/extensions/active_record.rb | |
| module ActiveRecord | |
| class Base | |
| class << self | |
| delegate :pluck, to: :scoped | |
| end | |
| end | |
| class CollectionProxy | |
| delegate :pluck, to: :scoped |
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 'oauth2' | |
| require 'foursquare2' | |
| class FoursquareBot | |
| BURGER_FUEL_PARNELL_ID = "4b3992a0f964a520d05d25e3" | |
| attr_accessor :client | |
| def initialize(token) | |
| @client = Foursquare2::Client.new(:oauth_token => token) | |
| 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
| # Add a key binding to your User Key Bindings and you're all good to go | |
| # { "keys": ["super+shift+h"], "command": "convert_hex_to_rgb" } | |
| # | |
| import sublime, sublime_plugin | |
| class ConvertHexToRgb(sublime_plugin.TextCommand): | |
| def run(self, edit): | |
| for region in self.view.sel(): | |
| if not region.empty(): |
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.ObjectWatcher = Ember.Object.create({ | |
| methodCounter: 0, | |
| observeOnce: function(object, property, callback) { | |
| var aroundCallbackName, callbackName; | |
| callbackName = "_method" + (this.methodCounter++); | |
| aroundCallbackName = callbackName.slice(1); | |
| this[callbackName] = callback; | |
| this[aroundCallbackName] = function() { | |
| this[callbackName](); | |
| object.removeObserver(property, this, aroundCallbackName); |
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
| // For reference: https://github.com/wagenet/ember.js/blob/ac66dcb8a1cbe91d736074441f853e0da474ee6e/packages/ember-handlebars/lib/views/bound_property_view.js | |
| var BoundHelperView = Ember._MetamorphView.extend({ | |
| context: null, | |
| options: null, | |
| property: null, | |
| // paths of the property that are also observed | |
| propertyPaths: [], | |
| value: Ember.K, |
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
| namespace :rubber do | |
| namespace :pdf do | |
| after "rubber:install_packages", "rubber:pdf:install_wkhtmltopdf" | |
| desc "install wkhtmltopdf see http://stackoverflow.com/questions/9672070/wicked-pdf-on-production-server/9687535#9687535 for details" | |
| task :install_wkhtmltopdf, roles: :app do | |
| sudo_script 'install_wkhtmltopdf', <<-ENDSCRIPT | |
| if ! which wkhtmltopdf &> /dev/null; then | |
| apt-get install -y wkhtmltopdf | |
| apt-get remove -y wkhtmltopdf --purge |
OlderNewer