Skip to content

Instantly share code, notes, and snippets.

View kulicuu's full-sized avatar

J Wylie Woodcock kulicuu

View GitHub Profile
@kulicuu
kulicuu / maker.coffee
Created June 19, 2016 16:43
automating XeLaTeX building on file change with CoffeeScript, Chokidar, NodeJS
c = -> console.log.apply console, arguments
spawn = require('child_process').spawn
chokidar = require 'chokidar'
args = ['-output-directory=build', 'new_minimal_whitespace_version_000.tex']
opts =
cwd: './'
chokidar.watch('./new_minimal_whitespace_version_000.tex').on 'all', (event, path) ->
c 'file changed recompiling...'
new_minimal = spawn('xelatex',args, opts)
@kulicuu
kulicuu / fragment_shader_000.glsl
Last active June 11, 2016 17:40
some generative webGL nonsense
attribute vec2 a_position;
void main() {
gl_Position = vec4(a_position, 0, 1);
}
@kulicuu
kulicuu / direct_trajectory.coffee
Created June 11, 2016 07:17
Knight Errant a knight's path problem
c = -> console.log.apply console, arguments
moves =
one: [1, 2]
two: [2, 1]
three: [2, -1]
four: [1, -2]
five: [-1, -2]
six: [-2, -1]
@kulicuu
kulicuu / anagram_test_000_.coffee
Created November 27, 2015 21:06
interview question
c = -> console.log.apply console, arguments
rayy_equals = (rayy_a, rayy_b)->
if rayy_a.length isnt rayy_b.length
return false
else
for idx in [0 .. (rayy_a.length - 1)]
if rayy_a[idx] isnt rayy_b[idx]
return false
@kulicuu
kulicuu / package.json
Last active November 28, 2015 19:00
site_000 dependencies
{
"dependencies": {
"gl-matrix": "latest",
"react-dom": "0.14.0-beta1",
"react": "0.14.0-beta1",
"bluebird": "latest",
"mathjs": "latest",
"flux": "latest",
"webpack-glsl-loader": "latest",
"worker-loader": "latest",
@kulicuu
kulicuu / ants.clj
Created November 20, 2015 09:50 — forked from michiakig/ants.clj
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
c = -> console.log.apply console, arguments
test_order = (rayy)->
for idx in [0 .. (rayy.length - 2)]
if rayy[idx] > rayy[idx + 1]
return false
return true
get_random_rayy = (n) ->
rayy = []
c = -> console.log.apply console, arguments
get_random_rayy = require('./make_random_array_.coffee')
test_order = require('./test_ordered_000_.coffee')
rayy = get_random_rayy 11
c 'rayy', rayy.toString()
bubble_sort_002 = (rayy)-> # with recursion
idx = 0
def get_random_rayy(n)
rayy = []
0.upto(n - 1) {
num = (rand * 1000).floor
rayy.insert(-1, num)
}
return rayy
end
@kulicuu
kulicuu / make_random_array_.coffee
Last active November 9, 2015 10:09
better quicksort
c = -> console.log.apply console, arguments
# return array of size n, of random unsigned integers between 0 and a thousand
get_random_rayy = (n) ->
rayy = []
for i in [0 .. (n - 1)]
rayy.push Math.floor(Math.random() * 1000)