Skip to content

Instantly share code, notes, and snippets.

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 January 21, 2016 20:59
get a midi file's notes and time offsets
// 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); })
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(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
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)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LogicInTypeSystem
{
public class Person
{
@JimmyHoffa
JimmyHoffa / gist:8244850
Created January 3, 2014 19:31
Simpler stuff..
// 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 November 19, 2013 21:34
random ass guess example of combinator repository
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 October 15, 2013 17:40
Something like this... just off the top of my head
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,