Because loading gems can take longer than you think
Now available as a gem - get it here
| #!/bin/bash | |
| #encrypt files with aes-256-cbc cipher using openssl | |
| #install: | |
| # sudo wget -O /usr/bin/enc https://gist.github.com/krisf/5391210/raw/4a105a6b8f98f39e9e74a1dd2a78ef6f631acdb1/enc | |
| # sudo chmod +x /usr/bin/enc | |
| # enc --help | |
| #encrypt files | |
| if [ $1 == "-e" ]; | |
| then |
| # DelayedJob | |
| @user.delay.activate!(@device) # Delay any object | |
| Notifier.delay.signup(@user) # Delay ActionMailer | |
| #DelayedJob supports a number of ways to make methods async | |
| def send_mailer | |
| # Some other code | |
| end | |
| handle_asynchronously :send_mailer, :priority => 20 |
| module ActiveRecord::UnionScope | |
| def self.included(base) | |
| base.send :extend, ClassMethods | |
| end | |
| module ClassMethods | |
| def union_scope(*scopes) | |
| id_column = "#{table_name}.#{primary_key}" | |
| sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ") | |
| where "#{id_column} IN (#{sub_query})" |
Because loading gems can take longer than you think
Now available as a gem - get it here
| # Add these two gems | |
| gem 'ice_cube', '0.9.3' | |
| gem 'squeel', '1.0.16' |
| /* ============================================================= | |
| * bootstrap-typeahead.js v2.2.2 | |
| * http://twitter.github.com/bootstrap/javascript.html#typeahead | |
| * ============================================================= | |
| * Copyright 2012 Twitter, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * |
| RSpec.configure do |config| | |
| config.around do |example| | |
| # For examples using capybara-webkit for example. | |
| # Remove this if you don't use it or anything similar | |
| if example.metadata[:js] | |
| example.run | |
| ActiveRecord::Base.connection.execute("TRUNCATE #{ActiveRecord::Base.connection.tables.join(',')} RESTART IDENTITY") | |
| else | |
| ActiveRecord::Base.transaction do |
| require 'delegate' | |
| class Base | |
| def foo | |
| "foo" | |
| end | |
| def bar | |
| "bar" | |
| end | |
| end |
| require 'sinatra' | |
| require 'rollbar' | |
| configure do | |
| Rollbar.configure do |config| | |
| config.access_token = 'aaaabbbbccccddddeeeeffff00001111' | |
| config.environment = 'sinatra-test' | |
| end | |
| end |
Changes:
this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .
ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.
this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.
This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.