Skip to content

Instantly share code, notes, and snippets.

# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@twetzel
twetzel / navigation_tabs.js
Created July 10, 2012 20:40
jquery tabs with back & forward buttons
// Form-Tabs with 'previous' & 'next' buttons
var $the_tabs = $('#tabs').tabs();
$("#tabs .ui-tabs-panel").each(function(i){
var totalSize = $("#tabs .ui-tabs-panel").size() - 1;
log( totalSize );
if (i != totalSize) {
next = i + 2;
$(this).find('.editable-tab-box .headline')
.append("<a href='#' class='next-tab trigger right' rel='#" + $(this).next('.ui-tabs-panel').attr('id') + "'></a>");
}
@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
* =============================
@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 / 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 / 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)$
<!-- 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 / private_pub-on-nginx.md
Created July 22, 2012 00:58
private_pub/faye on nginx