Skip to content

Instantly share code, notes, and snippets.

View ozten's full-sized avatar

Austin King ozten

View GitHub Profile
@ozten
ozten / handlebars_layouts_express_handlebars_adapter.js
Last active March 11, 2017 15:11
Adapter layer for bridging `handlebars-layouts` and `express-handlebars`.
/**
* Adapter layer for bridging `handlebars-layouts` and `express-handlebars`.
*
* Usage:
* var exphbs = require('express-handlebars');
* var handlebarsLayout = require('handlebars-layouts');
* var exphbsAdapter = require('express-handlebars-layouts-adapter');
*
* handlebarsLayout(exphbsAdapter);
* var exphbs.create({
@ozten
ozten / walker_tests.sh
Created July 29, 2014 19:30
List of manifests which should be good in production
Environments: docs/ENVIRONMENTS.md
export APP=minimalist
export MANI=http://minimalist.ngokevin.com/minimalist.webapp
echo $APP
mkdir $APP
rm -Rf $APP/*
curl -v -k "${ENDPOINT}/application.apk?manifestUrl=${MANI}" -o ${APP}/${APP}.apk
java -jar ~/Projects/apk-factory-service/lib/ext/apktool.jar d -f ${APP}/${APP}.apk ${APP}/${APP}
@ozten
ozten / gist:4c6a6e8e4f00d5b0c62d
Created July 9, 2014 17:37
client-sessions secureProxy
+++ b/server/bin/betafox
@@ -78,6 +78,7 @@ confsys.withConfig(function(config) {
cookieName: sessionConf.cookieName,
secret: sessionConf.secret,
duration: sessionConf.duration,
+ secureProxy: true,
cookie: {
secure: (config.env === 'production' ? true : false),
httpOnly: true,
macro _arms {
rule {(default => $value:expr)} => {
else {
return $value;
}
}
rule {(rule {$cond:expr} => $value:expr)} => {
if($cond) {
return $value;
}
macro _match_cond {
rule {$o($field)} => {
(typeof $o.$field !== 'undefined')
}
rule {$o($field $rest...)} => {
_match_cond $o($field) && _match_cond $o($rest...)
}
}
macro _match_var {
rule {$o($field)} => {
macro $if {
rule {
($x...)
} => {
if (relCar($x...))
}
}
macro $while {
rule {
macro def {
rule {
$name:ident ( $($params:ident : $type:ident) (,) ...) $body
} => {
// just throwing away the type annotation. The semantics of type
// annotations left as an exercise to the reader :)
function $name ($params (,) ...) $body
}
}
@ozten
ozten / twitter-manfiest-rate-limit.txt
Created June 3, 2014 04:51
A Cache file being rated limited for ec2 instance
curl -v https://mobile.twitter.com/cache/twitter.webapp
* About to connect() to mobile.twitter.com port 443 (#0)
* Trying 199.16.156.43... connected
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
npm ERR! Error: No compatible version found: normalize-package-data@'^0.2.13'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.3","0.0.5","0.0.7","0.0.9","0.0.10","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5","0.1.6","0.1.7","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.2.8","0.2.9","0.2.11","0.2.12","0.2.13"]
npm ERR! at installTargetsError (/home/travis/.nvm/v0.8.26/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at /home/travis/.nvm/v0.8.26/lib/node_modules/npm/lib/cache.js:641:10
npm ERR! at saved (/home/travis/.nvm/v0.8.26/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:138:7)
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
@ozten
ozten / multi-dimensional.js
Created November 11, 2013 16:43
Working with multi-dimensional arrays of various sizes using constants and functions
var GROUP = 0;
var SUB_GROUP = 1;
...
releases[GROUP];
releases[SUB_GROUP];
function getGroup(data, releaseOffset) {