Skip to content

Instantly share code, notes, and snippets.

View Ravenstine's full-sized avatar

Ten Bitcomb Ravenstine

View GitHub Profile
require "./compiler/crystal/**"
while line = gets
compiler = Crystal::Compiler.new
program = Crystal::Program.new
program.target_machine = compiler.target_machine
prelude = program.normalize(Crystal::Require.new("prelude"))
@MetaThis
MetaThis / server.js
Created August 25, 2011 22:03
Simple example of a Node.js proxy to CouchDB GET requests
var http = require('http'),
request = require('request'), // request module from https://github.com/mikeal/request
url = require('url');
http.createServer(function (req, res) {
var href = url.parse(req.url,true).href;
request('http://127.0.0.1:5984' + href).pipe(res);
}).listen(1337);
// now try something like http://127.0.0.1:1337/your_db_name/_all_docs/?limit=10
# Graham Scan - Tom Switzer <thomas.switzer@gmail.com>
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def turn(p, q, r):
return cmp((q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]), 0)
def _keep_left(hull, r):
while len(hull) > 1 and turn(hull[-2], hull[-1], r) != TURN_LEFT:
hull.pop()
@girliemac
girliemac / geo.js
Last active October 14, 2017 03:44
Geohashing
var lat, lon;
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
lon = position.coords.longitude;
console.log('lat: ' + lat);
console.log('lon: ' + lon);
console.log('geohash: ' + geohash(lat, 0) + '' + geohash(lon, 0));
@jezreljane
jezreljane / 42-things.md
Created October 25, 2012 05:51 — forked from xdite/42-things.md
Ten (42) Things You Didn't Know Rails Could Do
@stsvilik
stsvilik / gulpfile.js
Last active June 4, 2019 11:24
Gulp browserify, babelify, uglify and concat vendor files
/*! gulpfile.js */
const gulp = require("gulp");
const gutil = require("gulp-util");
const browserify = require("browserify");
const buffer = require("vinyl-buffer");
const uglify = require("gulp-uglify");
const sourcemaps = require("gulp-sourcemaps");
const source = require("vinyl-source-stream");
const concat = require("gulp-concat")
@atelierbram
atelierbram / sass-convert_from-sass-to-scss.sh
Created January 25, 2014 18:31
Convert .sass syntax to .scss in terminal
# http://blog.teamtreehouse.com/the-absolute-beginners-guide-to-sass
# Enter the folder you want to convert in your terminal and type in:
sass-convert --from sass --to scss -R .
# where -R means recursively and . means the current directory.
@mcasperson
mcasperson / gist:11315910
Last active December 3, 2020 07:49
Pandoc Emscripten
Add this to Ghc-Options in pandoc.cabal
-fllvm -keep-llvm-files -fforce-recomp
./emcc <all *.ll files> -o pandoc.js
emcc ./src/Text/Pandoc.ll ./src/Text/Pandoc/Compat/TagSoupEntity.ll ./src/Text/Pandoc/Compat/Monoid.ll ./src/Text/Pandoc/XML.ll ./src/Text/Pandoc/Writers/ICML.ll ./src/Text/Pandoc/Writers/FB2.ll ./src/Text/Pandoc/Writers/Man.ll ./src/Text/Pandoc/Writers/EPUB.ll ./src/Text/Pandoc/Writers/RST.ll ./src/Text/Pandoc/Writers/Docbook.ll ./src/Text/Pandoc/Writers/Org.ll ./src/Text/Pandoc/Writers/Markdown.ll ./src/Text/Pandoc/Writers/HTML.ll ./src/Text/Pandoc/Writers/ConTeXt.ll ./src/Text/Pandoc/Writers/Docx.ll ./src/Text/Pandoc/Writers/Texinfo.ll ./src/Text/Pandoc/Writers/MediaWiki.ll ./src/Text/Pandoc/Writers/Native.ll ./src/Text/Pandoc/Writers/Shared.ll ./src/Text/Pandoc/Writers/OpenDocument.ll ./src/Text/Pandoc/Writers/ODT.ll ./src/Text/Pandoc/Writers/Custom.ll ./src/Text/Pandoc/Writers/OPML.ll ./src/Text/Pandoc/Writers/RTF.ll ./src/Text/Pandoc/Writers/AsciiDoc.ll ./src/Text/Pandoc/Writers/LaTeX.l
@mattbaker
mattbaker / converttest.js
Created December 22, 2011 20:41
Send a PNG of a red square to STDOUT using node.js and convert
/* converttest.js: Send a PNG of a red square to STDOUT
* ex. node converttest.js > test.png
*/
var convert = require('child_process').spawn("convert", ["svg:", "png:-"]),
svgsrc = '<svg><rect height="100" width="100" style="fill:red;"/></svg>';
convert.stdout.on('data', function (data) {
process.stdout.write(data);
});
convert.stdin.write(svgsrc);
convert.stdin.end();
@MichaelLawton
MichaelLawton / gist:ee27bf4a0f591bed19ac
Last active February 23, 2021 09:17
Installing Maya 2015 SP5 on Ubuntu 14.04 LTS with Student License. I recommend using my new gist instead: https://gist.github.com/MichaelLawton/32ca5cf6145f0ca4a7ebcdc510d7447d
#References:
#http://forums.autodesk.com/t5/installation-licensing/installing-maya-on-ubuntu/td-p/4905036
#http://askubuntu.com/questions/392806/installing-maya-on-ubuntu-linux
#https://gist.github.com/insomniacUNDERSCORElemon/5555214
#http://nealbuerger.com/2013/05/ubuntu-13-04-maya-2014-install-script/
#http://www.nkoubi.com/blog/tutorial/how-to-install-autodesk-maya-2011-on-debian-ubuntu/
#http://help.autodesk.com/view/MAYAUL/2015/ENU/?guid=GUID-E7E054E1-0E32-4B3C-88F9-BF820EB45BE5
#http://www.andrewhazelden.com/blog/2014/10/autodesk-nlm-licensing-issues-with-maya-2015-and-max-2015/