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
alias kp=kill_process | |
kill_process(){ | |
ps -ef | grep $@ | grep -v grep | awk '{print $2}' | xargs kill -9 | |
} | |
e.g: you may have ran 'rails s &', 'gitk &', 'middleman &' | |
you kill with kp rails | |
useful to logout of all current ssh connections |
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
//resources.json | |
{ | |
"apiVersion": "0.1", | |
"apis": [ | |
{ | |
"description": "Operations about projects", | |
"path": "/project.{format}" | |
}, | |
{ | |
"description": "Operations about tickets", |
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 render_json_response(type, hash) | |
unless [ :ok, :error ].include?(type) | |
raise "Invalid json response type: #{type}" | |
end | |
default_json_structure = { | |
:status => type, | |
:data => nil, | |
:error => nil, |
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
upstream unicorn_production { | |
server unix:/usr/local/nature-valley/current/tmp/sockets/unicorn.sock; | |
} | |
server { | |
listen 80; | |
server_name "Name of the server"; | |
access_log /var/log/nginx/nv.log; | |
error_log /var/log/nginx/nv.error.log; | |
root "public directory of Rails App; |
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
@form.ajaxForm | |
dataType: 'json' | |
beforeSend: => | |
# ui treatement | |
uploadProgress: (event, position, total, percentComplete) => | |
# progress ui | |
complete: (xhr) => | |
# fetch model based on id |
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
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*} |
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/a/8936202 | |
# | |
# ActiveAdmin already includes the necessary jquery in active_admin/base, | |
# so just add this to javascripts/active_admin.js after //= require active_admin/base | |
# | |
# | |
# Serialize and Sort | |
# | |
# model_name - you guessed it, the name of the model we are calling sort on. | |
# This is the actual variable name, no need to change it. |
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
inigo:tmp> script | |
Script started, file is typescript | |
inigo:tmp> git --no-pager log --pretty=format:"" --graph | |
# | |
# lots of colour output | |
# | |
inigo:tmp> exit | |
exit | |
Script done, file is typescript | |
# http://www.pixelbeat.org/scripts/ansi2html.sh |
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
// simple fragment shader | |
// 'time' contains seconds since the program was linked. | |
uniform float time; | |
uniform sampler2D tex; | |
uniform sampler2D tex2; | |
float radius = .5; |
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
package main | |
import ( | |
"fmt" | |
"golang.org/x/net/html" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
"sort" |