Skip to content

Instantly share code, notes, and snippets.

View dancrew32's full-sized avatar
🕶️
🕶

Dan Masquelier dancrew32

🕶️
🕶
View GitHub Profile
@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.
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 / 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
@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 / 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 / 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 / ermagherd.js
Created July 26, 2012 23:08
ermagherd translator for node.js
// to use in nodejs, just var erma = require('./ermagherd.js').ermagherd;
// erma.gherd('my string');
var erma = {
translate: function(word) {
// Don't translate short words
if (word.length == 1) {
return word;
}
@dancrew32
dancrew32 / ssh-copy-id
Created August 24, 2012 22:02
ssh copy id as in /usr/bin/ssh-copy-id
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@dancrew32
dancrew32 / uber.js
Created November 14, 2012 21:37
Uber.js, call an UberCab from command line.
#!/usr/local/bin/casperjs
/*
* Uber.js
* Call an UberCab from the command line
* Usage:
* update `email` and `pass` variables to match your uber.com account
* ./uber.js <my address>
*/
@dancrew32
dancrew32 / rdiopop.log
Last active December 23, 2015 10:09
rdio chrome popping noise log
loading.target.rdio: 81.574ms www.rdio.com/:27
loading.js: 687.297ms www.rdio.com/:27
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] Loader is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] Storage is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] ShortcutManager is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] WebSocketFactory is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [FallbackWrapper] Embedding fallback swf core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] Notifications is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Services] OfflineMonitor is ready core.rdio.a7d29e55813049a4dbf6f873a8816314.js:1
[Wed Sep 18 2013 22:04:52 GMT-0700 (PDT)] [Timer] loading.target.rdio: