Skip to content

Instantly share code, notes, and snippets.

@twetzel
twetzel / deploy.rb
Last active February 22, 2018 09:37 — forked from Jesus/deploy.rb
compile assets local with capistrano 3.2.1 and rails 4.1.1 (fully integrated)
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
namespace :deploy do
desc 'Compile assets'
task :compile_assets => [:set_rails_env] do
# invoke 'deploy:assets:precompile'
invoke 'deploy:assets:precompile_local'
invoke 'deploy:assets:backup_manifest'
# Update, upgrade and install development tools:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential git-core libssl-dev libsqlite3-dev curl nodejs nginx
# Install rvm
\curl -sSL https://get.rvm.io | bash -s stable
@twetzel
twetzel / textmate_folder_pref.rb
Last active December 29, 2015 23:19
Textmate folder preferences
## Show hidden files in TextMate by Chris Your
## https://gist.github.com/chrisyour/728445
## File Patern
# old
!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
# new
!(/\.(?!\W*)[^/]*|\.(gitkeep|DS_Store|tmproj|o|pyc)|/Icon\r|/svn-commit(\.[2-9])?\.tmp)$
@twetzel
twetzel / pkill.sh
Created September 25, 2013 09:24
pkill for mac
#!/bin/sh
for that in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $that;
done
@twetzel
twetzel / replace_ruby_hash_syntax.md
Last active December 18, 2015 16:49
regular expression to change ruby hash syntax for TextMate | Sublime | etc

Old => New:

Find:
  :(\w+)[\s]+=>[\s]+
Replace:
  $1: 

New => Old:

@twetzel
twetzel / .profile
Created July 28, 2012 20:35
Expect script for Capistrano .. to deploy a private git repo (need sudo-pwd in deploy)
alias gcap='~/git_cap gitname gitpwd'
@twetzel
twetzel / private_pub-on-nginx.md
Created July 22, 2012 00:58
private_pub/faye on nginx
@twetzel
twetzel / pp_deamon.rb
Created July 22, 2012 00:35
private_pub Deamon .. kill process @ port
# => Start private_pub (Faye) as Deamon
RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -D
# => find Process on Port x
fuser -n tcp 9292
-> 9292/tcp: 3748
# => kill process
kill -9 3748
@twetzel
twetzel / server_setup.md
Created July 21, 2012 18:38 — forked from erotte/server_setup.md
Server Setup Ubuntu 10.4/rvm/nginx/passenger Hosteurope VM

Server Setup

Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.

Installation der benötigten Pakete

apt-get update

apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \

@twetzel
twetzel / jquery_ujs.js
Created July 11, 2012 14:46
jquery_ujs with 2 custom events to show loader / progressbar
(function($, undefined) {
/**
* Unobtrusive scripting adapter for jQuery
*
* Requires jQuery 1.6.0 or later.
* https://github.com/rails/jquery-ujs
* Uploading file using rails.js
* =============================