Skip to content

Instantly share code, notes, and snippets.

View kastner's full-sized avatar
🕳️
actively choosing...

Erik Kastner kastner

🕳️
actively choosing...
View GitHub Profile
#
# ElasticSearch Dockerfile
#
# https://github.com/dockerfile/elasticsearch
#
# Pull base image.
FROM dockerfile/java
# Install ElasticSearch.

Copy and paste the swift code below into a playground to experiment.

This is a very close emulation of Functor and Monad typeclasses in swift. However, it is very fragile (i.e. easy to crash the compiler).

For example, instance methods of fmap will run fine, but attempting to use a globally defined fmap that acts on Functor types will cause a crash. Similarly for bind. Unfortunately this means we cannot define the nice infix operator versions of these functions.

gem 'activerecord', '4.0'
gem 'sqlite3'
input = "[{id: 'lookingAtFoo0', inResponseTo: 'looking at foo', onFinish: 'delete foo'}, {name: 'looking at foo', inResponseTo: 'found foo', onFinish: 'clikced foo'}]"
nodes = {}
class Node
def initialize(thisId)
self.id = thisId
end
suits = %w| ⚫️ ⚪️ 🔴 🔵|.reverse
suits = %w|♦️ ️♣ ️♥️ ♠️|.reverse
nums = ["A"] + (2..9).to_a + %w|* J Q K|
cards = suits.map {|s| nums.collect {|i| "%s %s " % [i, s]}.reverse}.flatten
# cards = (1..52).map {|i| "%02d " % i}
puts cards.length
puts cards.join("|")
irb
[14:20:42] kastner:kickstarter git:(master) $ irb
~/Development/ksr/kickstarter (main) > a = %w|a b c|
=> [
[0] "a",
[1] "b",
[2] "c"
]
~/Development/ksr/kickstarter (main) > b = a
=> [
@kastner
kastner / index.html
Created July 19, 2013 23:54
A CodePen by Erik Kastner.
<canvas id="canvas" width="500" height="500"></canvas>
five = require("johnny-five");
board = new five.Board({ debug: false});
board.on("ready", function() {
var servo1 = five.Servo({pin: 9});
var servo2 = five.Servo({pin: 10});
var servo3 = five.Servo({pin: 11});
board.repl.inject({
servo1: servo1, s1: servo1,
@kastner
kastner / kin.js
Created March 31, 2013 02:03
forward and reverse kinematics for a linear delta bot
DELTA_DIAGONAL_ROD = 288.5
// Horizontal offset from middle of printer to smooth rod center.
DELTA_SMOOTH_ROD_OFFSET = 206.0 // mm
// Horizontal offset of the universal joints on the end effector.
// DELTA_EFFECTOR_OFFSET = 32.0 // mm
DELTA_EFFECTOR_OFFSET = 32.0 // mm
// Horizontal offset of the universal joints on the carriages.
@kastner
kastner / README.md
Last active December 15, 2015 11:19 — forked from mbostock/.block