Skip to content

Instantly share code, notes, and snippets.

@bhenry
bhenry / plink-plonk.js
Created February 25, 2020 20:20 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@bhenry
bhenry / jruby10.rb
Created July 29, 2016 15:20 — forked from IndianGuru/jruby10.rb
JRuby and Amazon S3
require "rubygems"
require "bundler/setup"
require 'yaml'
require 'aws-sdk'
#require 'jruby-openssl'
bucket_name = "talim"
file_name = "jrubyaws.txt"
(ns om-life.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[om-life.events :as e :refer [publish! event]]
[sablono.core :as html :refer-macros [html]]))
(def seed
#{[8 13] [9 13] [4 11] [6 13] [8 14] [11 14] [4 12] [5 13]
[4 13] [14 14] [12 13] [15 14] [12 14] [14 13] [38 13]
[37 13] [34 13] [35 14] [4 14] [34 14] [5 14] [32 13]
(ns scoreboard.test
(:require [scoreboard.events :as e :refer [publish!]]
[scoreboard.core :as s]))
(def score-range (range 0 150))
(def timeouts-range (range 1 4))
(def paths-values
[[[:home :score] score-range]
[[:home :timeouts] timeouts-range]
(defonce init
(reset! app-state
{:home {:home? true
:score 0
:timeouts 3}
:away {:home? false
:score 0
:timeouts 3}
:ball-on 50
:to-go 10
@bhenry
bhenry / csv.lua
Created March 20, 2014 23:59 — forked from cuixin/csv.lua
-- Using lua to parse CSV file to a table.
-- Notice: first line must be data description filed.
-- The separator is '|', change it if you want.
-- Usage: csv = require('csv')
-- tab = csv.load('test.csv', ',')
-- table.foreach(tab[1], print)
-- print(tab[1].you_field)
--encoding=utf-8
@bhenry
bhenry / 20.php
Created May 1, 2012 13:25 — forked from anonymous/20.php
euler 20
<?php
function facto($x){
$r = 1;
for($i=$x;$i>1;$i--){
$r *= $i;
}
return $r;
}
=== public final java.lang.Class ===
[ 0] static forName : Class (String)
;;subset of (clojure.contrib.repl-utils/show Class)
;; how do i use forName method.
(.forName Class "mystringhere")
;;results in
@bhenry
bhenry / mapping_trouble.clj
Created September 7, 2011 18:30 — forked from aufrank/mapping_trouble.clj
mapping trouble
(def nodes
{:k {:neighbors [:kaet] :activation 0.2}
:ae {:neighboars [:kaet] :activation 0.2}
:t {:neighbors [:kaet] :activation 0.2}
:kaet {:neighbors [:k :ae :t :cat] :activation 0.2}
:cat {:neighbors [:kaet] :activation 0.2}})
(map #(:activation (% nodes)) (-> nodes :kaet :neighbors))
;; for 18 and 67 in project euler
(defn max-path-sum
"give it a vector of vectors that form a triangle"
([t] (max-path-sum t (- (count t) 2) (t (dec (count t)))))
([t top bot]
(if (> top 0)
(max-path-sum
t
(dec top)
(vec