Skip to content

Instantly share code, notes, and snippets.

View jpsilvashy's full-sized avatar
🎯
Focusing

JP Silvashy jpsilvashy

🎯
Focusing
View GitHub Profile
set :application, 'foo'
set :repository, '_site'
set :scm, :none
set :deploy_via, :copy
set :copy_compression, :gzip
set :use_sudo, false
set :host, '127.0.0.1'
role :web, host
role :app, host
#!/usr/bin/env bash
sudo mysqladmin shutdown
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sed '/MYSQLCOM=-YES/ d' /etc/hostconfig
(function ($) {
$.event.special.textchange = {
setup: function (data, namespaces) {
$(this).bind('keyup', $.event.special.textchange.handler);
$(this).bind('cut paste input', $.event.special.textchange.delayedHandler);
},
teardown: function (namespaces) {
(my_key: value, another_key: value)
({:my_key => value, :another_key => value})
@jpsilvashy
jpsilvashy / generate_bson_ids.rb
Created September 19, 2011 18:55
Generate 20 BSON Ids
#!/usr/bin/env ruby
# encoding: utf-8
require 'bson'
20.times do
puts BSON::ObjectId.new
end
@jpsilvashy
jpsilvashy / deploy.rb
Created October 3, 2011 05:41
Same deploy.rb for a Rails 3 project
require "bundler/capistrano"
load 'deploy/assets'
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
cmd = "cd #{fetch(:latest_release)} && #{fetch(:rake, "rake")} RAILS_ENV=#{fetch(:rails_env, "production")} #{rake_cmd}"
@jpsilvashy
jpsilvashy / simple_server.sh
Created February 24, 2012 18:51
Simple Server
python -m SimpleHTTPServer 8888
@jpsilvashy
jpsilvashy / pow.sh
Created February 28, 2012 08:10
pow
#!/bin/sh
# W
# R RW W.
# RW::::RW DR::R
# :RRRRRWWWWRt:::::::RRR::::::E jR
# R.::::::::::::::::::::::::::Ri jiR:::R
# R:::::::.RERRRRWWRERR,::::::Efi:::::::R GjRRR Rj
# R::::::.R R:::::::::::::;G RRj WWR RjRRRRj
# Rt::::WR RRWR R::::::::::::::::fWR::R; WRW RW R
# WWWWRR:::EWR E::W WRRW:::EWRRR::::::::: RRED WR RRW RR
@jpsilvashy
jpsilvashy / install.rb
Created February 28, 2012 08:17
WEBrick bin link installer for Simple Server
#!/bin/sh
#
# Install Simple Server by running this command:
# curl https://raw.github.com/gist/1930743/c5b9b6d6579701e2c376f84d5073d8367001bc9e/install.rb | sh
#
# Set up the environment. Respect $VERSION if it's set.
set -e
SS_ROOT="$HOME/Library/Application Support/Simple Server"
@jpsilvashy
jpsilvashy / simple_server.rb
Created February 28, 2012 08:24
simple_server
#! /usr/bin/env ruby
require 'webrick'
root = File.absolute_path(".")
server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root
# catch int and shutdown
trap 'INT' do server.shutdown end