Skip to content

Instantly share code, notes, and snippets.

/*global React, flyd, R*/
(function () {
'use strict';
var Player = function (control) {
return function (players) {
var player = {};
var possibleNewPosition = flyd.stream([control.move], function () {
return (player.position() || 0) + control.move();
});
var canMove = flyd.stream([possibleNewPosition], function () {
@bgourlie
bgourlie / mortality.md
Last active December 2, 2017 21:54
Interpreting DUSCMPUB-formatted mortality data

Interpreting mortality data in DUSCMPUB format

This gist explains how to interpret the DUSCMPUB-formatted mortality data found [here][1] in conjunction with the [reference PDF][2].

The [reference PDF][2] uses 3 components to describe the type of data, its location within the row, and its size:

  • data item: A specific datapoint, for example, a value representing the highest completed level of education.
  • tape location: The column within the line where a data item is located. Each character in a line represents a column, with each line having 472 columns.
  • size: The number of columns used to represent a particular data item.
@sky-y
sky-y / my-open-emacs-at-point.el
Created August 5, 2012 08:58
Emacs: Open the file which filename is pointed in an other window or dired
;; Open the file name being pointed in an other window or dired
;; reference: http://kouzuka.blogspot.com/2011/02/emacsurlfinder.html
(defun my-directory-or-file-p (path)
"return t if path is a directory,
return nil if path is a file"
(car (file-attributes path)))
(defun my-open-emacs-at-point ()
"open the file with opening emacs"
(interactive)
@mikermcneil
mikermcneil / waterline.min.js.gz.sh
Created February 3, 2014 22:12
browserify, minify, and gzip Waterline
# browserify, minify, and gzip Waterline:
$ browserify lib/waterline.js -s Waterline | uglifyjs | gzip -c -f > browser/waterline.min.js.gz
@samgiles
samgiles / flatMap.js
Created June 20, 2014 11:32
Javascript flatMap implementation
// [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (:
Array.prototype.flatMap = function(lambda) {
return Array.prototype.concat.apply([], this.map(lambda));
};
@bangonkali
bangonkali / symlink.sh
Created August 9, 2016 15:03
Creating a symlink for visual studio code on mac os x el capitan
  • ## To watch
  • Ergo Proxy (2006-) TV
  • fargo 2 - [ ] Burnt (2015)
  • Bone Tomahawk (2015)
  • Black Sails (2014)
  • Macbeth (2015)
  • A Few Good Men (1992)
  • ## Postapocalyptic
  • Mad Max (1979) i reszta części
  • Water world (1995)
@Tetralux
Tetralux / tiny.zig
Last active March 11, 2023 10:37
A simple example of a calculator programming language that compiles to native code!
//
// A simple example of a calculator programming language, that compiles to native code!
//
// Written by Tetralux <tetraluxonpc@gmail.com>, 2023-03-09.
//
// Programs are a string that you pass as an argument in the form of a mathmetical expression.
// e.g: '10 + 4 - 1 + 7'.
// This program will generate some Zig code that computes the answer, and prints it to stdout.
// It then will invoke the Zig compiler as a subprocess to compile and run this program.
//
@burke
burke / remotepaste.md
Last active September 26, 2023 11:04
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@kristianhellquist
kristianhellquist / custom.el
Created July 10, 2012 09:50
Emacs, copy current file and line number to clipboard
(defun copy-current-line-position-to-clipboard ()
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'"
(interactive)
(let ((path-with-line-number
(concat (buffer-file-name) ":" (number-to-string (line-number-at-pos)))))
(x-select-text path-with-line-number)
(message (concat path-with-line-number " copied to clipboard"))))
(define-key global-map (kbd "M-l") 'copy-current-line-position-to-clipboard)