Skip to content

Instantly share code, notes, and snippets.

View ahx's full-sized avatar

Andreas Haller ahx

View GitHub Profile
@ahx
ahx / object.js
Created April 23, 2015 06:07
How to make Ember never auto-generate ObjectControllers (deprecated), but normal Controllers
// Add this file: app/controllers/object.js – Done.
// Ember.ObjectController will be removed in Ember 2.0 and auto-generated ObjectControllers
// cause deprecation warning since Ember 1.11.
// This file is here so ember does not generate ObjectControllers anymore.
// See https://github.com/emberjs/ember.js/blob/06e41ad7ccd28558dd4e651aa070bc06f7757821/packages/ember-routing/lib/system/generate_controller.js#L11-L26
import Ember from 'ember';
export default Ember.Controller;
@ahx
ahx / shoes_midi_keyboard.rb
Created September 1, 2008 16:54
A very simple onscreen midi-keyboard using Shoes and Midator.
#
# A simple onscreen midi-keyboard using Shoes and Midiator.
# No key-up Event.
#
# Set Keyboard layout here:
KEYBOARD_LAYOUT = :de # only :de and :us are supported, by now. See MidiKeymap#map_keys!
#
# You will need a midi input for this.
# On OSX you could use http://notahat.com/midi_patchbay
# and http://notahat.com/simplesynth or Garage Band
#
# A try to built a simple drummachine using Shoes and Midiator.
# Unfortunalty animation seems to be quite processor heavy. Things might get slow..
# Because of that, the beats don't get highlighted on beat.
#
# You will need a midi input for this.
# On OSX you could use http://notahat.com/midi_patchbay
# and http://notahat.com/simplesynth or Garage Band
#
# Usage:
@ahx
ahx / .profile
Created December 29, 2008 17:35
my .profile (aka .bashrc) file
#
# Your previous .profile (if any) is saved as .profile.mpsaved
# Setting the path for MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:$PATH
# Setting PATH for MacPython 2.5
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
export PATH=/usr/local/graphviz/bin:$PATH
// import fullscreen.*;
import processing.video.*;
MovieMaker mm;
// FullScreen fs;
PImage img;
PGraphics mask;
String[] images;
int imgIndex = 0;
int xOffset;
<html>
<head>
<title>Coding</title>
<style type="text/css" media="screen">
html {
font-size: 120%;
padding: 1em;
background-color:#FF6;
font-family: Helvetica, sans-serif;
}
//######### How to send authenticity_token automatically with every Ajax.Request.
//######### This will be obsolete in Rails 3 (as Yehuda mentiones here : https://rails.lighthouseapp.com/projects/8994/tickets/2696-prototypehelper-no-auth-token-param-for-get-requests#ticket-2696-2)
//######### Put this in your application.js
// Monkeypatches Ajax.Base to include authenticity_token parameter unless its already there
(function() {
function insert_auth_token (options) {
var o = options || {};
if (typeof(o.parameters) == "String" && !o.parameters.include("authenticity_token")) {
o.parameters = o.parameters + "&authenticity_token="+AUTH_TOKEN;
# my stupid way to switch between ruby versions for one terminal session
# (ruby 1.9 is in /usr/local/bin. 1.8 is in /usr/bin)
export ORIGPATH=$PATH
alias r19='export PATH=$ORIGPATH' # currently ruby 1.9 is the default on this installation
alias r18='export PATH=/usr/bin:$ORIGPATH'
From d22977fdec95113a937f557fdc07b7fe3c6c77c4 Mon Sep 17 00:00:00 2001
From: Andreas Haller <andreashaller@gmail.com>
Date: Tue, 22 Sep 2009 15:43:05 +0200
Subject: [PATCH] fixes checking for block parameter on Ruby 1.9
I replaced
rb_block_given_p() != Qtrue
with
!rb_block_given_p()
# geme (aka mategem, vigem..) - open gem source in $EDITOR
geme() {
_geme_init_gemdir
$EDITOR $GEMDIR/gems/`$(which ls) $GEMDIR/gems | grep -x $1.* | sort | tail -1`/
}
_geme() {
_geme_init_gemdir
COMPREPLY=()
local curw=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -W '$(ls $GEMDIR/gems)' -- $curw));