Skip to content

Instantly share code, notes, and snippets.

View dancrew32's full-sized avatar
🕶️
🕶

Dan Masquelier dancrew32

🕶️
🕶
View GitHub Profile
@dancrew32
dancrew32 / trackpoint.sh
Created June 2, 2012 22:00
Make trackpoint scrolling work in ubuntu 11.04
#!/bin/sh
xinput list | sed -ne 's/^[^ ][^V].*id=\([0-9]*\).*/\1/p' | while read id
do
case `xinput list-props $id` in
*"Middle Button Emulation"*)
xinput set-int-prop $id "Evdev Wheel Emulation" 8 1
xinput set-int-prop $id "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop $id "Evdev Wheel Emulation Timeout" 8 200
xinput set-int-prop $id "Evdev Wheel Emulation Axes" 8 6 7 4 5
xinput set-int-prop $id "Evdev Middle Button Emulation" 8 0
@dancrew32
dancrew32 / spotify.php
Created April 23, 2012 19:00
find and play a track by command line
#!/usr/bin/php
<? // just ./spotify.php
$api = array(
'context' => stream_context_create(array('http'=>array('method'=>'GET'))),
'ns' => 'spotify',
'url' => 'http://ws.spotify.com/search/1/track.json?q=',
);
fwrite(STDOUT, 'Pick a song: ');
@dancrew32
dancrew32 / changebyregex.js
Created November 8, 2011 23:44
search and replace text nodes in indesign
(function() {
var aintShit = NothingEnum.nothing;
function changeShit() {
var from = prompt('Change:', '');
var to = prompt('To:', '');
app.findGrepPreferences.findWhat = from;
app.changeGrepPreferences.changeTo = to;
app.documents.item(0).changeGrep();
@dancrew32
dancrew32 / gist:1179496
Created August 29, 2011 21:47
install phpsh
git clone https://github.com/facebook/phpsh.git && cd phpsh && sudo python setup.py build && sudo python setup.py install
function deParam (params, coerce) {
var obj = {};
var coerce_types = { 'true': !0, 'false': !1, 'null': null };
var decode = decodeURIComponent;
// Iterate over all name=value pairs.
$.each(params.replace(/\+/g, ' ').split('&'), function(j, v){
var param = v.split( '=' ),
key = decode(param[0]),
val,
@dancrew32
dancrew32 / FindFile.vim
Created July 25, 2011 19:00
FindFile.vim with tabnew
" vim600: set foldmethod=marker:
" $Id:$
" PURPOSE: {{{
" - FindFile: Switch to an auto-completing buffer to open a file quickly.
"
" REQUIREMENTS:
" - Vim 7.0
"
" USAGE:
" Put this file in your ~/.vim/plugin directory.