Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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)$
# 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 / 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'
@twetzel
twetzel / activerecord.de.yml
Created September 3, 2014 10:27
example label translation including active-record and active-model attributes
de:
attributes: &activerecord_attributes
user: &users_labels
email: "E-Mail"
name: "Name"
first_name: "Vorname"
last_name: "Nachname"
remember_me: "Angemeldet bleiben"
user:
one: "Nutzer"
@twetzel
twetzel / page.css
Last active August 29, 2015 14:06
workaround to show nested translations for phraseapp on-page editor
.no_view_translation {
display: none; position: relative;
margin: 0; padding: 0;
}
body.tranlating_phrase .no_view_translation {
display: block;
width: auto; height: auto;
opacity: .5;
}
@twetzel
twetzel / some_controller.rb
Created September 3, 2014 11:37
pull phraseapp translations in controller action
# ..
def pull_translations
if system('phrase pull --format=yml')
I18n.backend.reload!
redirect_to :back, notice: "Pulled translations from PhraseApp! :)"
else
redirect_to :back, alert: "Couldn't pull translations from PhraseApp! :("
end
end
// config/environment.js
// This is not for production. But it will get your
// console to stop screaming errors if your messing
// around with ember cli
module.exports = function(environment) {
//lots of stuff
// <Add this chunk>