Skip to content

Instantly share code, notes, and snippets.

View ghosthamlet's full-sized avatar

hamlet ghosthamlet

  • The Rest Is Silence of Code
View GitHub Profile
@staltz
staltz / introrx.md
Last active June 18, 2025 06:22
The introduction to Reactive Programming you've been missing
@schmatz
schmatz / greed_ogres.js
Created June 12, 2014 18:52
Ian Elliott's CodeCombat Greed code
var base = this;
if ( !base.init ) {
// Mark that we've ran the init code
base.init = true;
// Starting frame number
base.frames = 0;
// Amount of frames per second
@schmatz
schmatz / greed_human.js
Created June 12, 2014 18:35
Michael Heasell's CodeCombat Greed Code
// constants -------------------------------------------------------------------
var alliedTypes = {
peasant: 'peasant',
soldier: 'soldier',
knight: 'knight',
librarian: 'librarian',
griffinRider: 'griffin-rider',
captain: 'captain'
};
import numpy as np
from matplotlib import pylab as plt
#from mpltools import style # uncomment for prettier plots
#style.use(['ggplot'])
# generate all bernoulli rewards ahead of time
def generate_bernoulli_bandit_data(num_samples,K):
CTRs_that_generated_data = np.tile(np.random.rand(K),(num_samples,1))
true_rewards = np.random.rand(num_samples,K) < CTRs_that_generated_data
return true_rewards,CTRs_that_generated_data
@bzg
bzg / emacs-strip.el
Last active January 2, 2023 21:22
Emacs, naked
;; Prevent the cursor from blinking
(blink-cursor-mode 0)
;; Don't use messages that you don't read
(setq initial-scratch-message "")
(setq inhibit-startup-message t)
;; Don't let Emacs hurt your ears
(setq visible-bell t)
;; You need to set `inhibit-startup-echo-area-message' from the
;; customization interface:
@ckirkendall
ckirkendall / design.markdown
Last active January 3, 2016 22:59
Enliven Component Model

##Sketch for Enliven Component Model

This design page is a sketch of how I see enliven being used for dynamic templates in the browser.

Design Principles

  1. All state is in an application state object.
  2. State is scoped through lenses.
  3. Users should not have to manage lenses manually.
  4. There is no tree walking; paths/lenses, for dom manipulation, are determined at compile time.
@samuelclay
samuelclay / LED Dress.ino
Last active February 15, 2024 16:07
For New Year's Eve 2014, my girlfriend and I went to a dance party where wearable electronics were not only encouraged but also on display from a variety of hobbyists. I decided to use this as an opportunity to combine two of my favorite hobbies: sewing and electronics. We attached six addressable LED strands from Sparkfun ($20 each) to the lini…
#include <Adafruit_NeoPixel.h>
#include "WS2812_Definitions.h"
#define PIN_A 9
#define PIN_B 3
#define PIN_C 2
#define PIN_D 12
#define PIN_E 10
#define PIN_F 6
#define LED_COUNT 43
(ns explore-overtone.beethoven
(:use [overtone.live]))
;; Starting with this example
;; https://github.com/overtone/overtone/blob/master/src/overtone/examples/timing/internal_sequencer.clj
;; lets see about trying to get rid of the limitation on sequence
;; length.
;;
;; I'd like to create a composition outside the server in "beat space"
;; (play note N at beat B). I really enjoy working with the
@philfreo
philfreo / gist:7257723
Created October 31, 2013 21:44
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
;; Stolen from Read-Eval-Print-Love by the inimitable Michael Fogus
(defmacro schemish (functions &body body)
`(macrolet ,(mapcar (lambda (function)
`(,function (&rest args)
`(funcall ,',function ,@args)))
functions)
,@body))