Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Learning to make games

Tony Lukasavage tonylukasavage

💭
Learning to make games
View GitHub Profile
View async_hooks_MyInterval.js
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 Sep 1, 2017
basic async_hooks test
View async_hook.js
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`);
View compare.md

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
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…
View Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
end
View gist:45d10985697488362f8e
{
"browser": true,
"camelcase": false,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": false,
@tonylukasavage
tonylukasavage / load.js
Created Nov 12, 2014
implementing a node module
View load.js
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 Oct 28, 2014
open brace on next line
View test.js
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 Aug 31, 2014
grunt-titanium 0.1.0 vs. 0.2.0
View Gruntfile_0.1.0.js
grunt.initConfig({
titanium: {
create: {
options: {
command: 'create',
name: 'tmp',
workspaceDir: '.'
}
},
build: {
@tonylukasavage
tonylukasavage / .jshintrc
Created Jun 24, 2014
generic .jshintrc for ti, alloy, node.js, mocha
View .jshintrc
{
"browser": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"expr": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
@tonylukasavage
tonylukasavage / app.js
Created Jun 4, 2014
maybeCallback(), slightly modified, from node.js source, for adding default callbacks if they aren't provided, with optional options
View app.js
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 = {};