Skip to content

Instantly share code, notes, and snippets.

View ben-x9's full-sized avatar

Benjamin James ben-x9

View GitHub Profile
@yawaramin
yawaramin / sig
Last active June 12, 2022 05:03
Bourne Shell script to print out Merlin's inferred signature of an OCaml file (module)
#!/usr/bin/env sh
# Works with merlin version 2.5.4. Using protocol described at
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking
usage ()
{
echo Usage: either of the following will work:
echo
echo ' sig module.ml'
@PierrePaul
PierrePaul / stick.ts
Last active September 14, 2016 08:16
Phaser virtual joystick
/// <reference path="../lib/phaser.d.ts"/>
/// <reference path="../lib/socket.io.d.ts"/>
/// <reference path="ship.ts"/>
module AstRoidGame {
export class ControlStick extends Phaser.Group {
controlField: Phaser.Sprite;
stickCenterPos: Phaser.Point;
stick: Phaser.Sprite;
game: Phaser.Game;
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@schempy
schempy / stream-file-uploads-nodejs.js
Created March 11, 2015 21:59
Streaming File Uploads With Node.Js
var http = require('http');
var router = require('routes')();
var Busboy = require('busboy');
var port = 5000;
// Define our route for uploading files
router.addRoute('/images', function (req, res, params) {
if (req.method === 'POST') {
// Create an Busyboy instance passing the HTTP Request headers.
@bhauman
bhauman / core.cljs
Last active August 16, 2022 12:08
Helpful patterns when developing with ClojureScript Figwheel and Express js
(ns todo-server.core
(:require
[cljs.nodejs :as nodejs]
[figwheel.client :as fw]))
(nodejs/enable-util-print!)
(defonce express (nodejs/require "express"))
(defonce serve-static (nodejs/require "serve-static"))
(defonce http (nodejs/require "http"))
@nolanlawson
nolanlawson / wishlist.md
Last active May 3, 2021 11:51
Safari IndexedDB/WebSQL bug wishlist

Safari IndexedDB/WebSQL bug wishlist

Big overview of what's missing in Safari 7.1+ and iOS 8+ in terms of browser storage.

Updated May 25th 2016

Safari (general)

@paf31
paf31 / 24days.md
Last active August 8, 2023 05:53
24 Days of PureScript

This blog post series has moved here.

You might also be interested in the 2016 version.

@mauricecruz
mauricecruz / readme.md
Last active May 17, 2024 03:36
Zero Dark Matrix for Node Inspector
@john2x
john2x / 00_destructuring.md
Last active July 9, 2024 01:38
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@kurogelee
kurogelee / user.keymap
Created April 8, 2014 13:15
LightTableにpareditのショートカットキーを設定する ref: http://qiita.com/kurogelee/items/6275273d9b86343e9e24
{:+ {:app {"ctrl-q" [:workspace.show]
"alt-c" [:toggle-console :clear-console]}
:editor {"ctrl-w" [:editor.watch.watch-selection]
"ctrl-shift-w" [:editor.watch.remove-all]
"ctrl-alt-w" [:editor.watch.unwatch]
"ctrl-/" [:toggle-comment-selection]
"ctrl-i" [:smart-indent-selection]
"alt-left" [:editor.line-start-smart]
"alt-right" [:editor.line-end]