Skip to content

Instantly share code, notes, and snippets.

View tonylukasavage's full-sized avatar
💭
Learning to make games

Tony Lukasavage tonylukasavage

💭
Learning to make games
View GitHub Profile
@tonylukasavage
tonylukasavage / async_hooks_MyInterval.js
Created September 1, 2017 14:31
MyInterval with async_hooks
const async_hooks = require('async_hooks'),
fs = require('fs'),
http = require('http');
const hook = async_hooks.createHook({
init(asyncId, type, triggerAsyncId, resource) {
fs.writeSync(1, `[init] (${asyncId}:${triggerAsyncId}) ${type} - ${resource}\n`);
},
before(asyncId) {
fs.writeSync(1, `[before] (${asyncId})\n`);
@tonylukasavage
tonylukasavage / async_hook.js
Created September 1, 2017 13:56
basic async_hooks test
const async_hooks = require('async_hooks'),
fs = require('fs'),
http = require('http');
const hook = async_hooks.createHook({
init(asyncId, type, triggerAsyncId, resource) {
fs.writeSync(1, `[init] (${asyncId}:${triggerAsyncId}) ${type} - ${resource}\n`);
},
before(asyncId) {
fs.writeSync(1, `[before] (${asyncId})\n`);
@tonylukasavage
tonylukasavage / compare.md
Created June 3, 2015 11:36
yodiz vs. axosoft

Yodiz vs. Axosoft

Yodiz Axosoft
code formatting yes no
github integration sucks, no links, only commits great, links, works on commits, PRs, etc...
issue linking yes no
detailed work logs no yes
configurability no yes
@tonylukasavage
tonylukasavage / Vagrantfile
Created May 27, 2015 12:08
Use quick Vagrantfile to emulate a Travis CI environment (AKA, Ubuntu 12.04.5 LTS). Make sure you install vagrant (www.vagrantup.com) and VirtualBox (www.virtualbox.org/wiki/Downloads) first. Create the below Vagrantfile then simply run `vagrant up` in the folder in which it is located. After it boots you can run `vagrant ssh` to SSH into the he…
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
end
{
"browser": true,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": false,
@tonylukasavage
tonylukasavage / load.js
Created November 12, 2014 13:29
implementing a node module
var format = require('util').format,
fs = require('fs'),
path = require('path');
var code = '', testCode = '',
test = fs.readFileSync(path.join(__dirname, 'test', 'app_src.js'), 'utf8'),
template = 'exports.%s = function %s%s {\n' +
'\tthrow new Error(\'%s not yet implemented\');\n' +
'};\n\n',
testTemplate = '\tit(\'#%s\', function() {\n' +
@tonylukasavage
tonylukasavage / test.js
Created October 28, 2014 19:33
open brace on next line
if (val === 'sdfdsfsdf' ||
val === 'sdfsdfsfsf' ||
val > 23423423 ||
val < 123)
{
// I like the open brace on a new line _only_ in this situation
// so that there's a clear distinction between the end of the
// multi-line conditional and the beginning of the code
}
@tonylukasavage
tonylukasavage / Gruntfile_0.1.0.js
Created August 31, 2014 02:20
grunt-titanium 0.1.0 vs. 0.2.0
grunt.initConfig({
titanium: {
create: {
options: {
command: 'create',
name: 'tmp',
workspaceDir: '.'
}
},
build: {
@tonylukasavage
tonylukasavage / .jshintrc
Created June 24, 2014 13:27
generic .jshintrc for ti, alloy, node.js, mocha
{
"browser": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
@tonylukasavage
tonylukasavage / app.js
Created June 4, 2014 15:03
maybeCallback(), slightly modified, from node.js source, for adding default callbacks if they aren't provided, with optional options
var util = require('util');
function maybeCallback(cb) {
return util.isFunction(cb) ? cb : function(err) { if (err) throw err; };
}
function iShouldHaveACallback(opts, callback) {
callback = maybeCallback(arguments[arguments.length-1]);
if (!opts || util.isFunction(opts)) {
opts = {};