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 / gh-pages-deploy.md
Created February 12, 2020 09:16 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@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 / gist:bc60165661975b95c4964c803f84ecec
Last active August 28, 2017 21:39 — forked from prasofty/gist:2487410
Disable remote links after click in rails 3 +
$('a[data-remote=true]').on('ajax:before', function () {
if ($(this).hasClass('ajax-loading')) {
return false;
} else {
$(this).addClass('ajax-loading', true);
}
}).on('ajax:complete', function () {
$(this).removeClass('ajax-loading');
});
@twetzel
twetzel / simple-capistrano-docker-deploy.rb
Created August 23, 2017 20:37 — forked from johnbintz/simple-capistrano-docker-deploy.rb
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@twetzel
twetzel / partial_helper.js.coffee
Created June 21, 2012 04:02
.eco - Partials .. Render Partials in .jst.eco templates (for Rails + Spine / maybe Backbone)
# Render Partials in ECO-Templates like in Rails-ERB
#
# usefull to clean up structure in spine.js and other js-mvc´s like backbone
#
# usage:
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo
#
window.render_partial = ( path, options = {} ) ->
# add the leading underscore (like rails-partials)
@twetzel
twetzel / private_pub-on-nginx.md
Created July 22, 2012 00:58
private_pub/faye on nginx
<!-- solution 1, 117b, inspired by http://www.p01.org/releases/140bytes_music_softSynth/ -->
<button onclick="new Audio('data:audio/wav;base64,UklGRl9vT19XQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YU'+Array(1e3).join(123)).play()">Beep</button>
<!-- Solution 2, 107b, inspired by http://xem.github.io/chip8/c8.html -->
<button onclick="o=(A=new AudioContext()).createOscillator();o.connect(A.destination);o.start(0);setTimeout('o.stop(0)',500)">Boop</button>
@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