Skip to content

Instantly share code, notes, and snippets.

View joshburgess's full-sized avatar
💭
🤔

Josh Burgess joshburgess

💭
🤔
View GitHub Profile
var Rx = require('./rx.node')
, twitter = require('ntwitter')
, credentials = require('./credentials')
, io = require('socket.io').listen(80);
var customBind = function (self, method) {
return function () {
return self[method].apply(self, arguments);
};
};
@briancavalier
briancavalier / promise-monad-proof.js
Created August 8, 2012 15:57
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value
@esbullington
esbullington / d3-zoom-drag.md
Created October 15, 2012 14:38
easy d3 zoom and pan

I know a lot of people have trouble zooming and panning d3. Indeed, I found myself in a situation where I had a simple bar chart to which I wanted to add the zoom behavior, and also make the full chart draggable. I saw several extremely complex examples of d3 charts with zooming and panning, and thought that there must be an easier way, particularly if you don't need to scale the x and y axes. There is, and here is is in CoffeeScript:

vis.call(d3.behavior.zoom()
  .on("zoom", ->
    g.attr("transform", "translate(" + d3.event.translate[0] + "," + d3.event.translate[1] + ") scale(" + d3.event.scale + ")")
  )
)
@juderosen
juderosen / git-wars.md
Last active April 25, 2024 15:16
Git Wars: GitHub vs Bitbucket

Git Wars: GitHub vs Bitbucket

Introduction

Now, you might think the answer I'm going to give you is already obvious because I'm using GiHub right now, but it's not. Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans. In the following... thing, I'm going to compare the two and then offer a final solution that should work for most people.

TL;DR: Both. Use GitHub for open source and public repos (you'll spend most of your time here) and Bitbucket for private repos. But, sign up for GitHub first, then import account into Bitbucket. Also, check comments for updates. P.S. I personally prefer GitHub.

Interface and Functionality

@nvanderw
nvanderw / Free.ml
Created February 14, 2014 04:48
Free monads in OCaml, for great referential transparency
module type Functor = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
end
module type Monad = sig
type 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val return : 'a -> 'a t
@gelisam
gelisam / Main.hs
Last active August 22, 2022 18:18
IndexedMonad example
-- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/
--
-- We implement a tiny language with three commands: Open, Close, and Get.
-- The first Get after an Open returns 1, the second Get returns 2, and so on.
--
-- Get is only valid while the state is open, and
-- Open must always be matched by a Close.
-- We enforce both restrictions via the type system.
--
-- There are two valid states: Opened and Closed.
@joelhooks
joelhooks / egghead-screencast-guideline.md
Last active December 12, 2019 04:03
It seems trivial to record a 1-8 minute screencast, but there are actually quite a few moving parts when it comes to recording a **high quality** screencast. Here's some of our thoughts on the subject.

Recording a Great Coding Screencast

The Screen

First and foremost a coding screencast is about the code, and we need to make sure it looks great. There are a few aspects to this that help ensure that is the case.

Resolution

720p is the target resolution. In pixel terms this is 1280x720. We've gotten the best results when we record at 2560x1440 in a HiDPI (pixel double) mode, giving an effective visible resolution of 1280x720, but extremely crisp. This resolution is achievable on 27" monitors and retina MBPs.

(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@staltz
staltz / introrx.md
Last active July 4, 2024 10:11
The introduction to Reactive Programming you've been missing