Skip to content

Instantly share code, notes, and snippets.

@jbeuckm
jbeuckm / star_wand.scad
Created December 23, 2017 19:06
Toy to be 3D printed for my daughter
function flatten(l) = [ for (a = l) for (b = a) b ];
module star(r, points=6, thickness=4) {
outerRadius = r;
innerRadius = r/2;
step = 360 / points;
halfStep = step / 2;
@jbeuckm
jbeuckm / simple_csv_filter.js
Created November 4, 2016 19:55
A quick nodejs filter to process a CSV file.
var fs = require('fs');
var csv = require('csv');
var md4 = require('js-md4');
fs.createReadStream(__dirname+'/input.csv')
.pipe(csv.parse({columns: true}))
.pipe(csv.transform(function(record){
record.my_field = md4(record.my_field);
@jbeuckm
jbeuckm / main.js
Created April 7, 2016 15:46
A Brackets extension to insert a promise-returning function stub.
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, $, brackets */
define(function (require, exports, module) {
"use strict";
var CommandManager = brackets.getModule("command/CommandManager"),
EditorManager = brackets.getModule("editor/EditorManager"),
Menus = brackets.getModule("command/Menus");
@jbeuckm
jbeuckm / server.js
Created November 17, 2015 16:31
Very simple HTTP responder
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(process.env.PORT, process.env.IP);
console.log('Server running!');
@jbeuckm
jbeuckm / index.js
Created July 21, 2015 18:33
Using the `fft` library from `npm`.
var FFT = require('fft');
FFT_SIZE = 8;
var fft = new FFT.complex(FFT_SIZE, false);
var ifft = new FFT.complex(FFT_SIZE, true);
var inBuffer = new Float32Array([0,.5,1,.5,0,-.5,-1,-.5]);
var outBuffer = new Float32Array(2 * FFT_SIZE);
var outBuffer2 = new Float32Array(2 * FFT_SIZE);
@jbeuckm
jbeuckm / 020_replace_strings.js
Created June 17, 2015 14:49
Cordova hook to replace strings in the javascript.
#!/usr/bin/env node
// this plugin replaces arbitrary text in arbitrary files
//
// Look for the string CONFIGURE HERE for areas that need configuration
//
var fs = require('fs');
var path = require('path');
var glob = require("glob");
@jbeuckm
jbeuckm / insertStyles.js
Created May 15, 2014 16:13
Insert styles into the head element with jquery
function insertStyles(selectors, styles) {
var text = selectors.join(', ') + ' { ';
for (var i in styles) {
text += i + ':' + styles[i] + '; ';
}
text += '}';
@jbeuckm
jbeuckm / gist:10950742
Created April 17, 2014 03:24
keybase.md
### Keybase proof
I hereby claim:
* I am jbeuckm on github.
* I am jbeuckm (https://keybase.io/jbeuckm) on keybase.
* I have a public key whose fingerprint is 98AA E0F0 FC55 604F 78FB 1DC9 80A6 12E4 1266 F8B3
To claim this, I am signing this object:
@jbeuckm
jbeuckm / index.html
Last active May 27, 2019 05:24
K-Means in 3D
<html lang="en" xmlns:m="http://www.w3.org/1998/Math/MathML">
<head>
<meta charset="utf-8">
<style>
body {
margin: 0;
}
@jbeuckm
jbeuckm / index.html
Last active January 3, 2016 20:19
Hello, Three.js
<html>
<head>
<title>My first Three.js app</title>
<style>
body {
margin: 0;
}
canvas {
width: 100%;
height: 100%