Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan danneu

  • Texas
View GitHub Profile
@CatherineH
CatherineH / text_to_svg_path.py
Created Feb 1, 2018
Convert a text character to an SVG path.
View text_to_svg_path.py
from svgpathtools import wsvg, Line, QuadraticBezier, Path
from freetype import Face
def tuple_to_imag(t):
return t[0] + t[1] * 1j
face = Face('./Vera.ttf')
View gist:81ccc0e6652eccaf43cf
-Xmx10g
m2.xlarge (4 virtual cores)
Both Jetty and Netty execute the same code--generate 8k of random bits and compute a sha1, returning it over the wire.
INTERNAL (Benchmark tool runs on same machine)
--------
Jetty:
@danharper
danharper / gulpfile.js
Last active Jul 30, 2020
New ES6 project with Babel, Browserify & Gulp
View gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@stuarthalloway
stuarthalloway / schema_history.clj
Last active Mar 31, 2017
Complete schema history of a live Datomic database
View schema_history.clj
;; Complete schema history for a live Datomic database.
(require
'[clojure.pprint :as pp]
'[clojure.set :as set]
'[datomic.api :as d])
;; fill this in with your own database connection
(def uri "datomic:dev://localhost:4334/my-db")
(def conn (d/connect uri))
(def db (d/db conn))
@PixnBits
PixnBits / md5.js
Last active May 27, 2017 — forked from jhoff/md5.js
invalid reference fix
View md5.js
/*
* http://www.myersdaily.org/joseph/javascript/md5-text.html
*/
(function (global) {
var md5cycle = function (x, k) {
var a = x[0],
b = x[1],
c = x[2],
d = x[3];
@danielsz
danielsz / pushState.cljs
Last active Jul 15, 2016
PushState (via Html5History from google closure) with secretary, a client-side routing library for clojurescript. Allows to map absolute urls with routes without the hash-bang hackery.
View pushState.cljs
(def history (Html5History.))
(.setUseFragment history false)
(.setPathPrefix history "")
(.setEnabled history true)
(let [navigation (listen history EventType/NAVIGATE)]
(go
(while true
(let [token (.-token (<! navigation))]
(secretary/dispatch! token)))))
View catch.cljs
(ns blog.errors.core
(:require-macros
[cljs.core.async.macros :refer [go]]
[blog.utils.macros :refer [<?]])
(:require
[cljs.core.async :refer [>! <! chan close!]]))
;; convert Node.js async function into a something
;; that returns a value or error on a channel
(defn run-task [f & args]
View words.cljs
(defn words-proc [words button interval interval-control scrub]
(go (loop [idx 0]
(show-word! words idx)
(let [[v c] (alts! [button interval scrub])
(condp = c
button (do (>! interval-control v)
(recur idx))
interval (recur (inc idx))
scrub (do (>! interval-control :stop)
(recur v)))))))
View gist:5911181
(ns user
(:require [clojure.java.io :as io]
[datomic.api :as d]))
(defn order-schema []
(read-string (slurp (io/resource "schema.edn"))))
(defn start-datomic! [uri schema]
(d/create-database uri)
(let [conn (d/connect uri)]
@willurd
willurd / web-servers.md
Last active Oct 21, 2020
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
You can’t perform that action at this time.