View childProcessManager.ts
import type { ChildProcess, ChildProcessByStdio } from 'child_process'; | |
import type { Readable, Writable } from 'stream'; | |
import stripAnsi from 'strip-ansi'; | |
export enum Status { | |
Stopped = 'stopped', | |
Stopping = 'stopping', | |
Starting = 'starting', | |
Started = 'started', | |
} |
View Carthage-Dependencies.sh
## | |
## Source in Xcode Run Script Phase | |
## | |
set -e | |
CARTHAGE=$(command -v carthage) | |
## | |
## Validate |
View montyhall.js
/** | |
* The Monty Hall Problem | |
* https://en.wikipedia.org/wiki/Monty_Hall_problem | |
*/ | |
// convert 0.333 to 33% | |
const toPercentInteger = (fraction) => { | |
return Math.floor(fraction * 100) | |
} |
View priority-signals.js
/** | |
* This object represents a single listener of a Singal. | |
* A listener is simply an object with a reference to a function and thisArg, | |
* with a priority for insertion sorting and a once flag. | |
* @class | |
*/ | |
class Listener | |
{ | |
/** | |
* @param {Function} fn - The listener function |
View nodejs
#!/bin/sh | |
# | |
# chkconfig: 35 99 99 | |
# description: Node.js /home/nodejs/sample/app.js | |
# | |
. /etc/rc.d/init.d/functions | |
USER="nodejs" |
View otool-ls-r
#!/bin/bash | |
list="" | |
otool_list() { | |
local lib="$1" | |
local libs="" | |
if [[ "$list" == "${list/:$lib/}" ]]; then | |
echo "$lib" | |
list="$list:$lib" |
View build-openfl-samples.sh
## Needed for CI environment | |
export NEKOPATH="" | |
export HAXEPATH="" | |
export HAXE_STD_PATH="" | |
DIST="/path/to/dist" | |
rm -fR $DIST | |
SAMPLES=$(lime create openfl | sed -nr 's/ - (.+)/\1/p') | |
for sample in $SAMPLES |
View grunt-shell.js
module.exports = function(grunt) { | |
'use strict'; | |
var path = require('path'); | |
var spawn = require('child_process').spawn; | |
grunt.registerTask('$', 'Run command in the form $::cmd:arg1:arg2, or $:/blah:cmd:arg.', function() { | |
var done = this.async(); | |
var args = Array.prototype.slice.call(arguments); | |
var cwd = process.cwd(); |
View LinkedList.js
//I wanted a more elegant linkedlist example than the others, so purely for academic purposes I created one. | |
var LinkedList = function(e){ | |
var that = {}, first, last; | |
that.push = function(value){ | |
var node = new Node(value); | |
if(first == null){ | |
first = last = node; |
View gist:6143035
// create an new instance of a pixi stage | |
var stage = new PIXI.Stage(0x66FF99); | |
// create a renderer instance | |
var renderer = PIXI.autoDetectRenderer(400, 300); | |
// create a manager instance, passing stage and renderer.view | |
var manager = new PIXI.InteractionManager(stage, renderer.view); | |
stage | |
.on('click', function (event) { | |
console.log(event.type, event.target); // 'click', PIXI.DisplayObject {} |
NewerOlder