Skip to content

Instantly share code, notes, and snippets.

View yanneves's full-sized avatar

Yann イーベス Eves yanneves

View GitHub Profile
@yanneves
yanneves / index.html
Last active February 13, 2017 23:07
Mocha Programmatic API w/ JSPM
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Example Mocha Test</title>
</head>
<body>
<!-- Required for browser reporter -->
<div id="mocha"></div>
@yanneves
yanneves / gist:6c8204b4bc79e6e7c83c
Last active August 29, 2015 14:27
PlayCanvas Local Setup Node (Simple HTTP Server)
{
"name": "ludum-dare-33",
"version": "0.0.0",
"description": "Ludum Dare #LDJAM 33 Game Submission",
"main": " ",
"scripts": {
"start": "node_modules/.bin/http-server -p 51000 -c-1",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" }
]
@yanneves
yanneves / gist:cf0119fea456c7b9f0dd
Created September 15, 2014 13:07
_.serialize Underscore.js mixin
_.mixin({
// Serialize key-value pairs of an object into urlencoded format
serialize: function(obj) {
var pairs = _.pairs(obj);
return _.reduce(pairs, function(memo, pair) {
var key = _.first(pair), value = _.last(pair);
value = _.isFunction(value) ? value() : value;
return memo + '&' + encodeURIComponent(key) + '=' + encodeURIComponent(value);
}, '').replace('&', '').replace(/%20/g, '+');
}
@yanneves
yanneves / server-proxy.js
Created January 7, 2014 13:24
StackMob Node Proxy
// proxy all API requests
function proxy(method, path, headers, data) {
var defer = q.defer(), request,
pubKey = '****';
// filter paramaters contained in header, to avoid
// incorrectly identifying client domain and agent in request
headers = _.pick(headers, ['x-stackmob-api-key', 'x-stackmob-proxy-plain', 'x-stackmob-api-key-' + pubKey, 'accept', 'content-type', 'content-length', 'authorization']);
// format headers
headers = {