Example usage:
old_accounts = Account.where("created_at < ?", 1.month.ago)
old_abandoned_trials = AbandonedTrialQuery.new(old_accounts)
old_abandoned_trials.find_each do |account|
account.send_offer_for_support| var page = require('webpage').create(); | |
| page.open('http://jsbin.com/ifuma#noedit', function () { | |
| setTimeout(function () { | |
| page.sendEvent("mousedown", 10, 10); | |
| page.sendEvent("mousemove", 200, 200); | |
| page.sendEvent("mouseup", 200, 200); | |
| page.render('ss.png'); | |
| phantom.exit(); | |
| }, 3000); | |
| }); |
| #!/bin/sh | |
| NGINX_VERSION=1.3.8 | |
| TMP_PATH=/tmp | |
| # Fetch and extract Nginx | |
| cd $TMP_PATH | |
| wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | |
| tar xvfz nginx-$NGINX_VERSION.tar.gz | |
| cd nginx-$NGINX_VERSION |
| class Feature < Test::Unit::TestCase | |
| include Capybara::DSL, FactoryGirl::Syntax::Methods | |
| def teardown | |
| Capybara.reset_sessions! | |
| Capybara.use_default_driver | |
| end | |
| add_teardown_hook do |context| | |
| context.instance_eval do |
| # Shim for running Torquebox apps under MRI Ruby | |
| # http://www.rigelgroupllc.com/blog/2013/01/28/torquebox-shims-for-mri/ | |
| if ENV["INSIDE_TORQUEBOX"] == "true" | |
| Rails.logger.info "[TorqueBoxInitializer] Inside TorqueBox" | |
| else | |
| Rails.logger.info "[TorqueBoxInitializer] NOT inside Torquebox, shimming TB functions..." | |
| module TorqueBox | |
| module Messaging | |
| class MessageProcessor | |
| attr_accessor :message |
My Angular.js partials live in public/partials.
In development mode I want them served from there, in production I want to have an Angular.js module called templates which simply popuates the template cache for me.
This isn't just about performance in production: it's making sure the partials are embedded in the assets which forces the partial's lifetime to be the same as the assets with no other caching worries when we redeploy the app.
| #!/bin/sh | |
| curl -X DELETE 'localhost:9200/i/' | |
| curl -X POST 'localhost:9200/i/' -d '{ | |
| "settings" : { | |
| "number_of_shards" : 1, | |
| "number_of_replicas" : 0, | |
| "analysis" : { | |
| "analyzer" : { |
| ClientGetter playClientGetter = new ClientGetter() { | |
| private int playPort; | |
| private String playHost; | |
| { | |
| String portString = System.getenv("PLAY_PORT"); | |
| if (portString == null) | |
| portString = "9000"; | |
| playPort = Integer.parseInt(portString); | |
| playHost = System.getenv("PLAY_HOST"); |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"