This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copy this into the console of any web page that is interactive and doesn't | |
do hard reloads. You will hear your DOM changes as different pitches of | |
audio. | |
I have found this interesting for debugging, but also fun to hear web pages | |
render like UIs do in movies. | |
*/ | |
const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "bundler/setup" | |
require 'yaml' | |
require 'aws-sdk' | |
#require 'jruby-openssl' | |
bucket_name = "talim" | |
file_name = "jrubyaws.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function facto($x){ | |
$r = 1; | |
for($i=$x;$i>1;$i--){ | |
$r *= $i; | |
} | |
return $r; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 |
NewerOlder