This file contains 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
#!/usr/bin/env ruby | |
# coding: utf-8 | |
abort "Usage: fuck you <name>" unless ARGV[0] == "you" && ARGV.size == 2 | |
a = "abcdefghijklmnopqrstuvqxyz".each_char.to_a | |
b = "ɐqɔpǝɟƃɥıɾʞʃɯuodbɹsʇnʌʍxʎz".each_char.to_a | |
ws = Hash[a.zip(b)] | |
ws.default = ->(f){f} |
This file contains 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
s3_host_alias = "s3-ap-southeast-2.amazonaws.com" | |
Spree::Image.attachment_definitions[:attachment][:url] = s3_host_alias | |
Spree::Image.attachment_definitions[:attachment][:path] = '/spree/products/:id/:style/:basename.:extension' | |
Spree::Image.attachment_definitions[:attachment][:storage] = :s3 | |
Spree::Image.attachment_definitions[:attachment][:bucket] = ENV['s3_bucket'] | |
Spree::Image.attachment_definitions[:attachment][:s3_credentials]= { | |
:access_key_id => ENV['s3_access_key_id'], | |
:secret_access_key => ENV['s3_secret_access_key'] | |
} |
This file contains 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
group :production do | |
gem 'unicorn' | |
# Enable gzip compression on heroku, but don't compress images. | |
gem 'heroku-deflater' | |
# Heroku injects it if it's not in there already | |
gem 'rails_12factor' | |
end |
This file contains 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 | |
set -exo pipefail | |
BUILD_ENV=$1 | |
if [ `uname` == 'Darwin' ]; then | |
OSX=1 | |
JSCOMPRESSOR="yuicompressor --type js" | |
else | |
OSX= |
This file contains 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
# Basically the nginx configuration I use at konklone.com. | |
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com | |
# | |
# To provide feedback, please tweet at @konklone or email [email protected]. | |
# Comments on gists don't notify the author. | |
# | |
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. | |
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. | |
server { |
This file contains 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 'rubygems' | |
require 'mechanize' | |
FIRST_NAME = 'FIRST_NAME' | |
LAST_NAME = 'LAST_NAME' | |
PHONE = 'PHONE' | |
EMAIL = '[email protected]' | |
PARTY_SIZE = 2 | |
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' } |
This file contains 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
def write_backtrace name, backtrace, filename | |
exceptions = Regexp.union([ | |
/\.bundle/, | |
/spec/, | |
/test/, | |
/lib\/ruby\/1.9.1/ | |
]) | |
backtrace.reject! { |line| line =~ exceptions } |
This file contains 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 'singleton' | |
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code | |
# invoked during a single request. | |
# | |
# Example: | |
# | |
# 1) Make sure this file is loaded in an initializer | |
# | |
# 2) Add the following to your application.rb in Rails3: |
This file contains 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
var gpio = require("gpio") | |
var gpio22, intervalTimer | |
// Flashing lights if LED connected to GPIO22 | |
gpio22 = gpio.export(22, { | |
ready: blinkLED | |
}) | |
function blinkLED() { | |
intervalTimer = setInterval(function() { |
This file contains 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
// Sonic Screw Driver | |
// CONSTANTS AND VARIABLES | |
const int button2 = 2; | |
const int button3 = 3; | |
const int speaker = 4; | |
const int inputVoltagePin = 6; | |
const int IREMITTER = 7; | |
const int IRRECEIVER = 8; | |
const int LED = 9; |
NewerOlder