Skip to content

Instantly share code, notes, and snippets.

@petehunt
petehunt / gist:8396968
Created January 13, 2014 09:14
Sweet.js DSL for making persistent data structures feel imperative
macro := {
rule infix { $obj $([ $key ] ...) | $rval:expr } => {
$obj = mori.assoc_in($obj, [$key (,) ...].reverse(), $rval)
}
}
macro hash_map {
rule {{ $($key : $value) (,) ... }} => {
mori.hash_map($($key, $value) (,) ...)
}
@johnmyleswhite
johnmyleswhite / type_inference.jl
Created August 9, 2013 17:57
Julia's type inference is where you get performance
# Always ignore one run
x = 0
@elapsed for i in 1:100_000_000
x += 1
end # => 3.330939854
# Second time is more accurate
@robin-wittler
robin-wittler / gist:1643718
Created January 19, 2012 23:33
example code where ForeignKey and type check fails for flask-sqlalchemy
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Flask
from flaskext.sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash
from werkzeug.security import check_password_hash
from sqlalchemy.orm.exc import NoResultFound
app = Flask(__name__)
(flycheck-define-checker julia-lint
"A Julia syntax checker using Lint.jl."
:command ("julia" "-e"
"using Lint; lintfile(ARGS[1])" source-inplace)
:error-patterns
((info line-start
(zero-or-more blank)
(file-name) " "
(one-or-more (not digit))
line " INFO" (one-or-more blank) (message) line-end)