Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / leds-cycle.js
Created May 29, 2014 21:26
node.js + johnny-five @ jsconf 2014
var j5 = require('johnny-five');
var Leds = require('./leds').Leds;
var board = new j5.Board();
var delay = 20;
var leds;
board.on('ready', function() {
leds = new Leds(4, 13);
var button = new j5.Button(2);
@cowboy
cowboy / HoxHudTweakData.lua
Last active August 29, 2015 14:04
My Steam\steamapps\common\PAYDAY 2\HoxHud\HoxHudTweakData.lua file
--[[
This is the configuration file for HoxHud. Please be careful editing values as you can cause the game to crash upon loading if a value is made invalid
We recommend colorpicker.com if you want to choose a color to use. The game also has some predefined colors and they are used here purely for brevity.
Only the following Colors are defined explicitly:
Color.red (FF0000), Color.green(00FF00), Color.blue (0000FF), Color.cyan (0000FF), Color.purple(FF00FF), Color.black (000000), Color.white (FFFFFF), Color.yellow (FFFF00)
]]--
HoxHudTweakData = class()
@cowboy
cowboy / ahk-active-window.ahk
Last active August 29, 2015 14:11
AutoHotKey: Poll system for known active windows
; ===================================================
; Poll system for known active windows
; "Cowboy" Ben Alman - 2014
; https://gist.github.com/cowboy/77642d25ef49559d574f
; ===================================================
#Persistent
#SingleInstance Force
; Exe windows to poll for.
@cowboy
cowboy / 5757.md
Last active August 29, 2015 14:12
ed rare route
@cowboy
cowboy / script
Last active August 29, 2015 14:20
Latest Gyazo.app, modified to upload to my server.
#!/usr/bin/env ruby
require 'net/http'
# get id
user = IO.popen("whoami", "r+").gets.chomp
program = ARGV[0].to_s
idfile = "/Users/#{user}/Library/Gyazo/id"
old_idfile = File.dirname(program) + "/gyazo.app/Contents/Resources/id"
@cowboy
cowboy / files.txt
Last active August 29, 2015 14:25
Pizzicato Five ‎– The Band Of 20th Century
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 01 Intro.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 02 The Night Is Still Young.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 03 A New Song.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 04 Serial Stories.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 05 Triste.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 06 Sweet Soul Revue.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 07 To Our Children’s Children’s Children.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 08 Ma Vie, L’ete De Vie.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 09 Drinking Wine.mp4
Pizzicato Five - Happy End Of The Band (BS Fuji Studio Last Sessions) - 10 Goodbye Baby & Amen.mp4
// API
// all deparam methods return an object
$.deparam( params, coerce ) // deserialize params string, optionally coercing true, false, undefined, numbers
$.deparam.qs( coerce ); // get document query string as object
$.deparam.hash( coerce ); // get document hash as object
$.deparam.qs( params_or_url, coerce ); // get params from url or params string as object
// API
// history, window.onhashchange
$.history.add( params, merge_mode ); // set new 'state' (into location.hash, triggers hashchange event)
$.history.retrieve( key, coerce ); // get current 'state' (from location.hash, wrapper for $.deparam.hash)
$(window).bind( 'hashchange', function(e){
e.hash; // the current 'state' as normalized hash string
e.retrieve(); // like $.history.retrieve but for this specific state
function get_hash() {
var loc = document.location;
return loc.hash ? loc.href.replace( /^.*\#/, '' ) : '';
}
if ( 0 ) {
var esh = $.event.special.hashchange = {
setup: function(){
console.log( 'setup' );
$(this).bind( 'hashchange', esh.handler );