Skip to content

Instantly share code, notes, and snippets.

@zkochan
zkochan / example.yaml
Created January 4, 2016 14:39
zx file example
start: "node app"
test: "gulp test"
docker:
build: "docker-compose build"
run: "docker-compose up"
docs:
clean: "rimraf _book"
prepare: "gitbook install"
build:
- "zx docs:prepare"
@zkochan
zkochan / index.js
Last active November 13, 2015 23:19
requirebin sketch
var registerPlugin = require('register-plugin');
var domify = require('domify')
function helloWorld(app, options, next) {
app.sayIt = function() {
document.body.appendChild(domify('Hello world!'));
};
next();
}
@zkochan
zkochan / index.js
Last active November 8, 2015 13:39
requirebin sketch
'use strict';
var magicHook = require('magic-hook');
function Logger() {
magicHook(this, ['log']);
}
Logger.prototype.log = function(msg) {
console.log(msg);
[].filter || (Array.prototype.filter = // Use the native array filter method, if available.
function(a, //a function to test each value of the array against. Truthy values will be put into the new array and falsy values will be excluded from the new array
b, // placeholder
c, // placeholder
d, // placeholder
e // placeholder
) {
c = this; // cache the array
d = []; // array to hold the new values which match the expression
for (e in c) // for each value in the array,
./node_modules/.bin/actionhero generateInitializer —name=knex
‘pg_config’ is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to ‘pg_config —includedir’ returned exit status 1. while trying to load binding.gyp
gyp ERR! stack Error: Python executable “python” is v3.4.1, which is not supported by gyp.
$ npm install knex@0.6 --save
# Then add one of the following (adding a --save) flag:
$ npm install mysql
$ npm install mariasql
$ npm install pg
$ npm install sqlite3
configData.mySql = {
database: 'actionHero',
username: 'root',
password: 'root',
host: '127.0.0.1',
port: 3306,
}
var knex = require('knex');
exports.knex = function (api, next) {
api.knex = knex(api.configData.mySql);
next();
}