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
<html> | |
<head> | |
</head> | |
<body> | |
<div id="container1"> | |
  | |
</div> | |
<div id="container2"> | |
  | |
</div> |
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
var flatten = function(obj) { | |
var ret= {}; | |
for (var key in obj) { | |
if (!obj.hasOwnProperty(key)) continue; | |
if ((typeof obj[key]) == 'object' && obj[key] !== null) { | |
var flattened = flatten(obj[key]); | |
for (var childKey in flattened) { | |
if (!flattened.hasOwnProperty(childKey)) continue; | |
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
{:user {:plugins [[lein-pprint "1.1.1"] | |
[cider/cider-nrepl "0.9.0-SNAPSHOT"] | |
[venantius/ultra "0.3.3"] | |
[refactor-nrepl "0.3.0-SNAPSHOT"]]} | |
:ultra {:color-scheme :solarized_dark} | |
:dependencies [[slamhound "1.3.1"] | |
[alembic "0.3.2"] | |
[org.clojure/tools.nrepl "0.2.7"]] | |
:cuttle {:plugins [[lein-pprint "1.1.1"]]}} |
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
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var watchify = require('watchify'); | |
var browserify = require('browserify'); | |
var to5 = require('gulp-babel'); | |
var less = require('gulp-less'); | |
var path = require('path'); |
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
#a naive canvas cache, inefficient but simple to read | |
class CanvasCache | |
constructor: -> | |
counter: 0 | |
makeID: -> | |
num = @counter | |
@counter++ | |
# make it associative so items can be removed but have stable reference to test at least | |
num.toString() | |
items:[] |
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
(defn post [raw-post tags] | |
(let [formatted-post (dissoc (assoc raw-post | |
:file (add-post raw-post) | |
:date (Date. ) | |
:timestamp (System/currentTimeMillis) | |
:uuid (str (java.util.UUID/randomUUID)) | |
:edited (Date. )) :markdown) | |
add-post (fn [post] | |
(swap! config-atom update-in [:total-posts] inc) | |
(def file-name (str (@config-atom :directory) "/entry-" (@config-atom :total-posts) ".md")) |
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
(defn extFilter [ext, files] | |
(filter (fn [x] | |
(= (re-find #".{3}$" x) ext)) files)) |
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 intaglio.core | |
(:require [net.cgrand.enlive-html :as html] | |
[cheshire.core :refer :all] | |
[markdown.core :as md]) | |
(:import | |
(java.util Date UUID) | |
(java.io.StringReader))) | |
(use 'clojure.pprint) |
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
### | |
#tyler anderson 2012 | |
### | |
#cost = 1.0 | |
#a = 0.5 | |
_ = require('underscore') | |
abs = Math.abs | |
node = (@x,@y,parent,goal,cost = 1, a = 0.5) -> | |
@h = cost * ((abs(@x - goal.x) + abs(@y - goal.y))) | |
@g = 1.0 + (a * (parent?.g? - 1.0)) |