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
#!/bin/bash | |
# sidekiq Init script for Sidekiq | |
# chkconfig: 345 100 75 | |
# | |
# Description: Starts and Stops Sidekiq message processor for Stratus application. | |
# | |
# User-specified exit parameters used in this script: | |
# | |
# Exit Code 5 - Incorrect User ID | |
# Exit Code 6 - Directory not found |
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
SELECT people.first_name, | |
people.last_name, | |
SUM(CAST(transactions.amount_in_cents AS float) / 100.00), // total transaction amount all time | |
ytd.amount, | |
transactions.amount_in_cents, // last transaction processed | |
last_transaction.created_at // date of last transaction | |
FROM people | |
JOIN transactions | |
ON people.id = transactions.person_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
# Git pre-commit hook to check all staged Ruby (*.rb/erb/coffee) files | |
# for Pry binding references | |
# | |
# Installation | |
# | |
# ln -s /path/to/pre-commit.sh /path/to/project/.git/hooks/pre-commit | |
# | |
# Based on | |
# | |
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/ |
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
open(“| pbcopy”, “w”) { |clipboard| clipboard.write array.inspect } |
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
check process unicorn | |
with pidfile /path/to/pid/unicorn.pid | |
start program = "/sbin/service unicorn start" with timeout 120 seconds | |
stop program = "/sbin/service unicorn stop" | |
if totalmem is greater than 500 MB for 2 cycles then restart |
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
a = [1, 2, 3, 4] | |
a.each do |num| | |
# several | |
# lines | |
# of transformations | |
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
a = [1,2,3,4] | |
Enum.each a, fn (num) -> | |
# several | |
# lines | |
# of transformations | |
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
// Here, under the hood PhantomJS is opening | |
//localhost:3000/uri/goes/here and rendering it to a pdf. | |
var pdf = new NodePDF('localhost:3000/uri/goes/here', 'filename.pdf', {width:1440, height:900}); //the options might be optional. Play with it a bit. | |
// This is a callback for what to do on errors | |
pdf.on('error', function(msg){ | |
console.log(msg); // you may want to log errors while you're working on it at least. | |
// What you might really want to do when done is present an error to the user. | |
}); |
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
class Template < ActiveRecord::Base | |
belongs_to :template_type | |
def some_method | |
if template_type == :type_1 | |
# do type one things | |
elsif template_type == :type_2 | |
# do type two things | |
else | |
# something else |
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
class AwesomeTemplate < Template | |
# We don't even care about custom behavior in this template. | |
# We just want to be able to identify it as a different type | |
end |
OlderNewer