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 delete_letter | |
@user = User.find(params[:id]) | |
@user.remove_letter! | |
@user.save! | |
render :show | |
end | |
--- | |
[:delete_letter, :dl_copy, :payment_proof].each do |meth| |
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
# create a deploy user, and add them to sudoers | |
adduser deploy | |
gpasswd -a deploy sudo | |
# generate a key so you can just pop it on your github and pull your repo down from there | |
ssh-keygen -t rsa -C "your_email@example.com" | |
# test the connection so it adds the key to your authorized hosts list | |
ssh -T git@github.com | |
# add the phussion passenger package server key, and binaries source to to your apt packages list |
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
# Make it use C-a, similar to screen.. | |
unbind C-b | |
unbind l | |
set -g prefix C-a | |
bind-key C-a last-window | |
# Reload key | |
bind r source-file ~/.tmux.conf | |
set -g history-limit 1000 |
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
;; Create a new project with | |
;; lein new liberagent reagent-complex-gui-example | |
;; and replace main.cljs with this file | |
(ns reagent-complex-gui-example.main | |
(:require-macros [cljs.core.async.macros :refer (go)]) | |
(:require | |
[reagent.core :as reagent :refer [atom]] | |
[sablono.core :as html :refer-macros [html]] | |
[cljs-http.client :as http] |
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
# rbenv inspired by https://gist.github.com/1441139 | |
# make sure running as root user | |
apt-get -y update | |
apt-get install linux-headers-2.6.32-5-amd64 | |
apt-get -y upgrade | |
apt-get -y install curl git-core python-software-properties build-essential git-core curl libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev libcurl4-openssl-dev libxslt-dev libxml2-dev | |
# add-apt-repository | |
curl -o /usr/sbin/add-apt-repository http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txtchmod o+x /usr/sbin/add-apt-repository |
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
# Place in config/initializers | |
ActiveRecord::Base.class_eval do | |
class << self | |
def inherited_with_strong_params(sub) | |
inherited_without_strong_params(sub) | |
# Filter out plugin models that won't work with strong_parameters yet | |
unless sub.name =~ /^doorkeeper/i | |
sub.send :include, ActiveModel::ForbiddenAttributesProtection | |
end | |
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
#!/usr/bin/env ruby | |
require 'tempfile' | |
file = Tempfile.new(['js2coffee', '.js']) | |
file.write ARGF.read # write vim selection to tmp file | |
file.rewind | |
file.close | |
puts `js2coffee #{file.path}` # requires js2coffee | |
file.unlink # deletes the temp file |
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
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class | |
# https://github.com/plataformatec/simple_form/issues/316 | |
inputs = %w[ | |
CollectionSelectInput | |
DateTimeInput | |
FileInput | |
GroupedCollectionSelectInput | |
NumericInput | |
PasswordInput |
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
require 'pp' | |
class ProxyController < ApplicationController | |
# Example headers: | |
# {"GATEWAY_INTERFACE"=>"CGI/1.1", | |
# "PATH_INFO"=>"/proxy/http:/google.com", | |
# "QUERY_STRING"=>"", | |
# "REMOTE_ADDR"=>"127.0.0.1", | |
# "REMOTE_HOST"=>"127.0.0.1", |
OlderNewer