Skip to content

Instantly share code, notes, and snippets.

View puts the feed ticker on the side bar
javascript:$('.sidebar-widget').parent().prepend($('<div class="sidebar-widget"></div>').append($('#feed-ticker')));$('#feed-ticker').attr('style', 'display: block; max-width: 100%; position: relative; overflow-y: scroll;');
@JimmyHoffa
JimmyHoffa / someMidiFileJunk.js
Created Jan 21, 2016
get a midi file's notes and time offsets
View someMidiFileJunk.js
// Using: https://raw.githubusercontent.com/nfroidure/MIDIFile/master/dist/MIDIFile.js
$('#input-area').prepend('<input type="file" id="someFile" />'); $('#someFile').change(function() { var f = document.getElementById('someFile').files[0]; var fr = new FileReader(); fr.onload = function(d) { window.fileNotes = $.map(new MIDIFile(window.SomeBuff = d.target.result).getMidiEvents().filter(function(e) { return e.subtype === 9 || e.subtype === 8 }), function(e) { return { ms: e.playTime, note: (e.param1 - 27)/(67-27), on: e.subtype === 9 }; }) }; fr.readAsArrayBuffer(f); })
View debug.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View funJispZipLookupThingy
(def getZipLookupUri zip callbackFuncName (+ 'http://api.geonames.org/postalCodeLookupJSON?postalcode=' zip '&country=US&callback=' callbackFuncName '&username=jimmyhoffa'))
(def makeSimpleJsonpGetRequest uri
(do (= xhr (new XMLHttpRequest()))
(xhr.open 'GET' uri true)
(= xhr.onload (fn result (eval result.target.response)))
(xhr.send)))
(def createGeoNameResponseHandler callbackFunc
(do
View gist:b4fd667b30249008fa6c
let filter (key:string,items:FileSummary seq) =
(getGroupLineCount items) > threshold
summaries
|> Seq.groupBy (fun x->x.RelativePath)
|> (fun group -> if useThresholds then (Seq.filter filter group) else group )
|> (fun group -> if useTakeLimits.IsSome then Seq.take(useTakeLimits.Value) group else group)
|> Seq.map (fun (key,items) -> (key, items |> Seq.sumBy (fun i->i.LineCount) , items))
|> Seq.sortBy (fun (key,l,items)-> -l)
View LogicInTypeSystem.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LogicInTypeSystem
{
public class Person
{
View gist:8244850
// Make sure we got a filename on the command line.
if (process.argv.length < 3) {
console.log('Usage: node ' + process.argv[1] + ' FILENAME');
process.exit(1);
}
// Read the file and print its contents.
var fs = require('fs')
, filename = process.argv[2]
, happy = "";
fs.readFile(filename, 'utf8', function(err, data) {
@JimmyHoffa
JimmyHoffa / gist:7552976
Created Nov 19, 2013
random ass guess example of combinator repository
View gist:7552976
public class PersonModel
{
public int Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public bool Amazing { get; set; }
public PersonModel OnlyFriend { get; set; }
}
@JimmyHoffa
JimmyHoffa / gist:6995513
Created Oct 15, 2013
Something like this... just off the top of my head
View gist:6995513
KbdButton.prototype = {
installHotkey: function() {
// Install a single anchor in the body to catch our accessor.
var accessor = $( "<a accesskey='k' style='display:none; position:absolute;'>" );
$( "body" ).append( accessor );
var whichKey = 0;
var keyCaptureDialog = $("body").append('<div id="captureKeys"></div>').dialog({
resizable: false,
You can’t perform that action at this time.