Skip to content

Instantly share code, notes, and snippets.

View boxxxie's full-sized avatar
👙
disrupting absurdism

Paul Iannazzo boxxxie

👙
disrupting absurdism
View GitHub Profile
@boxxxie
boxxxie / mismatch.ex
Created October 9, 2016 18:06
in the below code, the is_map guard causes this code to take only that path, even when given a MapSet
def empty(%MapSet{}), do: MapSet.new()
def empty(obj) when is_map(obj), do: %{}
defmacro def_identity_matcher(name, map) do
quote do
def unquote(name)(unquote(map)), do: unquote(map)
end
end
@boxxxie
boxxxie / hacky sync version.js
Last active July 26, 2016 01:35
reading in a list of files in nodejs
var fs = require('fs');
function readFiles(dirname, onFileContent, onError) {
fs.readdir(dirname, function(err, filenames) {
if (err) {
onError(err);
return;
}
filenames.forEach(function(filename) {
fs.readFile(dirname + filename, 'utf-8', function(err, content) {
@boxxxie
boxxxie / basic todo list.elm
Last active June 28, 2016 02:19
this isn't the most basic. as it is showing how to use commands in the update function, and thus can't be used with HTML.beginnerProgram. this is an extension from the egghead todo list tutorial
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.App as Html
import Html.Events exposing (onInput, onClick)
import String exposing (..)
import Random exposing (..)
main =
Html.program
{
#!/bin/bash
# These functions require a CouchDB instance
rawurldecode() {
# This is perhaps a risky gambit, but since all escape characters must be
# encoded, we can replace %NN with \xNN and pass the lot to printf -b, which
# will decode hex for us
@boxxxie
boxxxie / jruby fail.sh
Last active December 17, 2015 05:18
jruby $(which bundle) output
jruby $(which gem) install bundler
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from DefaultResolver.java:111:in `makeTime'
from DefaultResolver.java:277:in `create'
from DefaultResolver.java:317:in `handleScalar'
from DefaultResolver.java:435:in `orgHandler'
from DefaultResolver.java:455:in `node_import'
from org/yecht/ruby/DefaultResolver$s_method_1_0$RUBYINVOKER$node_import.gen:65535:in `call'
@boxxxie
boxxxie / hashmap.rb
Last active December 17, 2015 05:09
hash map of hash keys in ruby
irb(main):205:0> a
{{1 => 5} => 2}
irb(main):206:0> a.put ( Hamster.hash (3 => 3) , 3)
SyntaxError: (irb):206: syntax error, unexpected tASSOC, expecting ')'
a.put ( Hamster.hash (3 => 3) , 3)
^
from /usr/bin/irb:12:in `<main>'
a.put { Hamster.hash (3 => 3) , 3}
SyntaxError: (irb):207: syntax error, unexpected tASSOC, expecting ')'
@boxxxie
boxxxie / cs2cs.sh
Last active December 17, 2015 00:09
wtf cs2cs has the stupidest api ever
echo 620680.98 4828301.47 | cs2cs -v +proj=utm +datum=NAD27 +zone=17 +to +proj=latlong +datum=WGS84 -f "%.6f"
;;rules examples
[[(findname ?person ?search) [(fulltext $ :person/firstname ?search) [[?person ?name]]]]
[(findname ?person ?search) [(fulltext $ :person/lastname ?search) [[?person ?name]]]]]
;;attempt at making some rule for searching for geohashs...
[[(findgeohash ?place ?search)
[(fulltext $ :coordinate/gehoash ?search)
[[?place ?name]]]]]
(defn pythagorean [a b c] (= (+ (* a a) (* b b)) (* c c)))
@boxxxie
boxxxie / gist:5240921
Created March 25, 2013 21:27
parks and rec stats
FacilityDisplayName stats
1 Farm Display
2 Skateboard Park
3 Curling Rink
4 Gallery
4 Stadium
5 Amphitheatre
6 Coat Check Room
6 Games Room