This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
grunt.initConfig({ | |
sweetjs: { | |
options: { | |
modules: ['es6-macros'], | |
sourceMap: true, | |
nodeSourceMapSupport: true | |
}, | |
src: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
ajaxify.go = function(url) { | |
window.location.href = RELATIVE_PATH + '/' + url; | |
}; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This module will load ./process.env.APP_ENV.json and exports it | |
// And will also read args from command line and merge them, i.e.: | |
// node index.js --server.hostname=192.168.56.1 | |
// will work. | |
// Usually this module should be in ./config/index.js | |
// And then you use var config = require('./config'); | |
// You must set an APP_ENV | |
if (!process.env.APP_ENV) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
import tempfile | |
import sqlite3 | |
import subprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function M(){}; | |
M.contResult = function(value){ | |
return function(cont){ | |
console.log('in result: ' + value); | |
return cont(value); | |
} | |
} | |
M.contBind = function(mValue, mFunc){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro sexp { | |
case () => { | |
; | |
} | |
case ($p) => { | |
$p | |
} | |
case ($x $y) => { | |
$x($y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maybe = (@value) -> | |
Maybe::ret = -> @value | |
Maybe::bind = (fn) -> | |
if @value? then (fn @value) else undefined | |
Maybe.lift = (fn) -> (val) -> new Maybe (fn val) | |
addOne = (val) -> val + 1 | |
maybeAddOne = Maybe.lift addOne |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A: is this pure function? | |
function sum(a, b) { return a + b } | |
// B: is this a pure function? | |
const k = 2 | |
function addK(a) { return a + k } | |
// C: is this a pure function? | |
function sub(a, b) { return sum(a, -b) } | |
// D: is this a pure function? | |
function sub(a, b, summer) { return summer(a, b) } | |
// E: is this a pure function? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xhr(options) { | |
var deferred = Q.defer(), | |
req = new XMLHttpRequest(); | |
req.open(options.method || 'GET', options.url, true); | |
// Set request headers if provided. | |
Object.keys(options.headers || {}).forEach(function (key) { | |
req.setRequestHeader(key, options.headers[key]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |
OlderNewer