Skip to content

Instantly share code, notes, and snippets.

View jwthomp's full-sized avatar

Jeff Thompson jwthomp

View GitHub Profile
; solving Ishmael problem from http://www.renesys.com/challenge_site/challenge/count_me_ishmael
; NOTE: The times below are inflated since the profiling code slows everything down
; Current profile
; seconds | consed | calls | sec/call | name
;--------------------------------------------------------------
; 0.391 | 33,214,464 | 952,404 | 0.0000004 | IS-CVVC
; 0.214 | 30,027,776 | 664,719 | 0.0000003 | IS-CHAR-CONSTANANT
; 0.156 | 0 | 2,308,632 | 0.0000001 | IS-CHAR-VOWEL
@jwthomp
jwthomp / ishamel.erl
Created April 5, 2011 15:10
Erlang implemention to solve ishmael problem
% solving Ishmael problem from http://www.renesys.com/challenge_site/challenge/count_me_ishmael
-module(ishmael).
-compile(export_all).
-define(FILENAME, "2701.txt").
time(Func) ->
Start = now(),
@jwthomp
jwthomp / monad.erl
Created January 25, 2012 04:46
Erlang Monad
-module(monad).
-export([ monad_context/2, putst/1, getst/0, lift/0, return/1 ]).
-export([ test/0 ]).
%%%%%%%%%%%%%%%%%%%%% Erlang Monad %%%%%%%%%%%%%%%%%%%%%%
%% Working on a simple monad implementation for Erlang %%
%% %%
%% Just for fun I tried whipping up a simple erlang %%
%% monad. It uses the process dictionary and I haven't %%
%% implemented lift and many children of a monad state %%
@jwthomp
jwthomp / gist:2400439
Created April 16, 2012 18:11
simple noir server
(ns dungeonverse.core
(:use noir.core)
(:require [noir.server :as server]))
(def the-server (atom nil))
(defpage "/welcome" []
"Welcome to Noir!")
(defn start [] (reset! the-server (server/start 8080 [:base-url "stf.gameoire.com"])))
@jwthomp
jwthomp / designer.html
Created April 30, 2015 15:36
designer
<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@jwthomp
jwthomp / test2.js
Created October 1, 2015 22:05
Bacon.js component playground
var Bacon = require("./vendor/Bacon.min.js");
var GameObject = function() {
this.bus = new Bacon.Bus();
this.eventStreams = [];
this.eventHandlers = [];
this.data = {};
}
GameObject.prototype.registerEventType = function(eventType) {
/*----------------------------------
* Kefir.Bus
*/
var Bus = function() {
Kefir.Pool.call(this);
}
Bus.prototype = Object.create(Kefir.Pool.prototype);
Bus.prototype.constructor = Bus;
Bus.prototype.push = function(x) {
# Switch prefix from C-b to C-b
set -g prefix C-a
unbind C-b
# Update delay time to be very short
set -s escape-time 1
# Set the base-index to 1 instead of 0, so we can use prefix 1 to get to the first window
set -g base-index 1
setw -g pane-base-index 1
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Html.App
type alias Model = Int
type Msg = Increment | Decrement
update : Msg -> Model -> Model
@jwthomp
jwthomp / Main.elm
Created May 16, 2016 01:03
Main.elm
import Html exposing (..)
import Html.App exposing (beginnerProgram, program)
import Html.Events exposing (onClick)
import Task
import Debug
type alias Model = Int
type Msg