Skip to content

Instantly share code, notes, and snippets.

View kzar's full-sized avatar
🐈
Bashing the rocks together...

Dave Vandyke kzar

🐈
Bashing the rocks together...
View GitHub Profile
@kzar
kzar / Jakefile
Created March 8, 2012 15:42
Work in progress Jake file for biratchet-js
task('test', function () {
var qunit = require('qunit');
function abspath(p) {
return __dirname + "/" + p;
}
qunit.run({
code : abspath("bitratchet.js"),
tests : abspath("test/bitratchet-test.js")
@kzar
kzar / gist:2037338
Created March 14, 2012 15:38
Android trouble (Nexus S with Ice cream sandwich connecting to Macbook Pro running Lion)
Mar 14 15:34:24 discodave kernel[0]: USBF: 5642.879 [0xffffff8014373c00] The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 4 of Hub at 0xfa100000)
Mar 14 15:34:27 discodave kernel[0]: USBF: 5645.877 [0xffffff8014373c00] The IOUSBFamily was not able to enumerate a device.
Mar 14 15:34:28 discodave kernel[0]: USBF: 5646.719 [0xffffff8014373c00] The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 4 of Hub at 0xfa100000)
Mar 14 15:34:31 discodave kernel[0]: USBF: 5650.116 [0xffffff8014373c00] The IOUSBFamily was not able to enumerate a device.
Mar 14 15:34:32 discodave kernel[0]: USBF: 5650.942 [0xffffff8014373c00] The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 4 of Hub at 0xfa100000)
Mar 14 15:34:33 discodave kernel[0]: USBF: 5651.774 [0xffffff8014373c00] The IOUSBFamily gave up enumerating a USB device after 10 ret
@kzar
kzar / afterdark.js
Created May 8, 2012 09:56
afterdark.co - Facebook login for gallery workaround - (paste in browser URL)
javascript:$(".galleryThumbnail").each(function(a){var b=$(this).attr("src").replace("thumbnails","full");$(this).parent().click(function(a){imageswap(b);return false})})
if (!jQuery.browser.msie || jQuery.browser.version.substring(0, 1) > 9) {
function pad(num, totalChars) {
var padding = new Array(totalChars - num.length).join("0");
return padding + num;
}
function changeColor(color, ratio, darker) {
color = color.replace(/^\s*|\s*$/,'');
color = color.replace(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,'#$1$1$2$2$3$3');
var difference = Math.round(ratio * 256) * (darker?-1:1),
@kzar
kzar / return_printed.php
Last active December 14, 2015 03:19
PHP return_printed function that takes a closure and returns as a string anything that was printed by it. (Thanks to Viper-7 in ##php, see his version that supports arguments http://codepad.viper-7.com/7ZSncY )
function return_printed() {
$args = func_get_args();
$f = array_shift($args);
if ($f) {
ob_start();
call_user_func_array($f, $args);
return ob_get_clean();
}
}
@kzar
kzar / gist:6204541
Created August 11, 2013 11:56
openELEC build gmp-5.1.2 failed
make[5]: Entering directory `/root/OpenELEC.tv/build.OpenELEC-RPi.arm-devel/gmp-5.1.2/.objdir-host/tests/cxx'
collect2: ld returned 1 exit statusnFAIL: t-binary
collect2: ld returned 1 exit statusnFAIL: t-cast
collect2: ld returned 1 exit statusnFAIL: t-cxx11
collect2: ld returned 1 exit statusnFAIL: t-headers
collect2: ld returned 1 exit statusnFAIL: t-iostream
collect2: ld returned 1 exit statusnFAIL: t-istream
collect2: ld returned 1 exit statusnFAIL: t-locale
collect2: ld returned 1 exit statusnFAIL: t-misc
collect2: ld returned 1 exit statusnFAIL: t-mix
@kzar
kzar / gist:7880173
Created December 9, 2013 20:25
Vagrant grunt-contrib-watch watchers issue
20:13 <kzar> (Why I need it at all is that nfs doesn't trigger
things like grunt-contrib-watch very quickly so my
code doesn't build on save quickly.)
20:13 <phinze> ah hey that's a problem i'm working on solving too
20:14 <phinze> i think the pending nfs_guest PR may help with this
- reverses the share direction
20:14 <phinze> are you running emacs on the host or the guest
20:14 <kzar> phinze: OH cool, yea I'm super-happy with vagrant in
every other way but the watch issue is killing me
20:14 <kzar> phinze: oh cool
<?xml version="1.0"?>
<cross-domain-policy>
</cross-domain-policy>
@kzar
kzar / gist:7397117c70b3a9bbf212
Created September 16, 2014 12:46
Highlight trailing whitespace and tabs red in emacs
; Highlight tabs and trailing whitespace everywhere
(setq whitespace-style '(face trailing tabs))
(custom-set-faces
'(whitespace-tab ((t (:background "red")))))
(global-whitespace-mode)
@kzar
kzar / counter.js
Created October 26, 2014 18:14
JS closure example
var counter = (function () {
var i = 0;
return {
view: function () { return i; },
next: function () { i += 1; }
}
})()