Follow these steps to install graphite on OS X Mavericks.
- Homebrew
- Python 2.7
- Git
def daemonize(name = File.basename($0), options = {}) | |
pid_path = options[:pid_path] || File.expand_path("tmp/pids/#{name}.pid") | |
# If the pid file exists, check that the process is actually still running. | |
begin | |
if File.exists?(pid_path) && Process.kill(0, File.read(pid_path).to_i) | |
$stderr.puts "Already running." | |
exit 1 | |
end | |
rescue Errno::ESRCH |
#!/bin/bash | |
set -exo pipefail | |
BUILD_ENV=$1 | |
if [ `uname` == 'Darwin' ]; then | |
OSX=1 | |
JSCOMPRESSOR="yuicompressor --type js" | |
else | |
OSX= |
#!/usr/bin/env ruby --disable-gems | |
# Roll your own two-factor authentication! Place this file on a USB key, make | |
# it executable, then run: | |
# | |
# two-factor --setup | |
# | |
# Now place each TOTP secret in its own file in the `keys/` directory. I like | |
# to name them after the website they apply to, but any name is fine. To | |
# generate a token, plug in your USB key and: |
class FoosController < ApplicationController | |
include Pundit | |
#... | |
# record policy | |
def set_record_policy | |
policy(PolicyContext.new(record, current_user) | |
end | |
# scope policy |
# Using v1 of Ruby aws-sdk as currently v2 seems not able to do this (broken?). | |
require 'aws-sdk-v1' | |
key = YOUR_AWS_KEY | |
secret = YOUR_AWS_SECRET | |
region = YOUR_AWS_REGION | |
AWS.config(access_key_id: key, secret_access_key: secret, region: region) | |
s3 = AWS::S3.new | |
bucket = s3.buckets[bucket_name] |
worker_processes 3 # amount of unicorn workers to spin up | |
timeout 30 # restarts workers that hang for 30 seconds | |
preload_app true | |
GC.respond_to?(:copy_on_write_friendly=) and | |
GC.copy_on_write_friendly = true | |
before_fork do |server,worker| | |
defined?(ActiveRecord::Base) and |
#!/bin/sh | |
# Based on: https://gist.github.com/ryanong/ad6e7570e3f72b22c0e4 | |
set -x | |
# Exit if any subcommand fails | |
set -e | |
if [ ! -d "/opt/qt55" ]; then | |
echo "Installing QT 5.5 ..." |
# Usage: link_to …, prompt: { message: 'Some message', default: 'default value', param: 'name of parameter' } | |
# The prompt will ask for "message" and use "default" as the default value. | |
# Unless user selects cancel, "param"=<new value> will be sent to the given path. | |
# Optionally, you can just use `prompt: "message"`. | |
$.rails.prompt = (message, defaultValue) -> | |
window.prompt message, defaultValue | |
$.rails.handlePrompt = (element) -> | |
config = element.data 'prompt' |
<!-- app/views/layouts/application.html.erb --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- ... --> | |
<% if Rails.application.config.disable_animations %> | |
<%= stylesheet_link_tag('disable_animations') %> | |
<!-- Turn off animations in jQuery --> | |
<script>$.fx.off = true;</script> |