Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
| /* | |
| Copyright 2011 Martin Hawksey | |
| 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 | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
| var kue = require('kue'), | |
| jobs = kue.createQueue(), | |
| util = require('util'), | |
| noop = function() {}; | |
| jobs.CLEANUP_MAX_FAILED_TIME = 30 * 24 * 60 * 60 * 1000; // 30 days | |
| jobs.CLEANUP_MAX_ACTIVE_TIME = 1 * 24 * 60 * 60 * 1000; // 1 day | |
| jobs.CLEANUP_MAX_COMPLETE_TIME = 5 * 24 * 60 * 60 * 1000; // 5 days | |
| jobs.CLEANUP_INTERVAL = 5 * 60 * 1000; // 5 minutes |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
There's an issue with cairo 14.x that results in the axis fonts on the graphs being HUUUUUGE. Downgrading to 12.6 helps:
As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.
All the complexity is handled by ActiveRecord::Transactions. Any model class or instance has a method named .transaction. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.
| #!/usr/bin/env bash | |
| # This script prints out all of your Redis keys and their size in a human readable format | |
| # Copyright 2013 Brent O'Connor | |
| # License: http://www.apache.org/licenses/LICENSE-2.0 | |
| human_size() { | |
| awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } ' | |
| } |
| var cradle = require('cradle'); | |
| var database = 'app'; | |
| cradle.setup({ | |
| host: '127.0.0.1', | |
| port: 5984, | |
| auth: { username: "YOUR_USERNAME", password: "YOUR_PASSWORD" } | |
| }); |
The following is an example workflow for developing on a temporary branch and merging back to the main branch squashing all commits into a single commit. This assumes you already have a branch named branch-xyz and have finished the work on that branch.
git checkout branch-xyz
| #!/bin/bash | |
| # | |
| #################################### | |
| # iTunes Command Line Control v1.0 | |
| # written by David Schlosnagle | |
| # created 2001.11.08 | |
| # edit 2010.06.01 rahul kumar | |
| #################################### | |
| showHelp () { |
| // Restify Server CheatSheet. | |
| // More about the API: http://mcavage.me/node-restify/#server-api | |
| // Install restify with npm install restify | |
| // 1.1. Creating a Server. | |
| // http://mcavage.me/node-restify/#Creating-a-Server | |
| var restify = require('restify'); |