Skip to content

Instantly share code, notes, and snippets.

View nullivex's full-sized avatar
😶
Come try my web friendly packages and check out Kado!

Bryan Tong nullivex

😶
Come try my web friendly packages and check out Kado!
View GitHub Profile
<script type="text/javascript">
var currentPosition = 0;
if (localStorage.currentPlayerPosition) {
currentPosition = localStorage.currentPlayerPosition;
}
player.once('play', function (){
'use strict';
if (currentPosition > 0 && Math.abs(player.getDuration() - currentPosition) > 5) {
player.seek(currentPosition);
}
@nullivex
nullivex / makeComputersAwesome.js
Created August 28, 2017 18:27
makeComputersAwesome
var makeComputersAwesome = function(){
return buildC()
.then(function(){
return P.all([
buildCPlusPlus(),
buildECMALang(),
buildErlang()
])
})
.then(function(){
@nullivex
nullivex / stream.js
Created August 25, 2014 21:36
Proper streaming from SSH2 on Node
'use strict';
var fs = require('fs')
var SSH = require('ssh2')
var conn = new SSH()
conn.on('ready',function(){
conn.exec('cat .ssh/known_hosts',function(err,stream){
stream.setEncoding('utf-8')
stream.on('readable',function(){
console.log('stream readable')
@nullivex
nullivex / ifb_wondershaper.sh
Created July 13, 2014 18:32
Wondershaper implementation that uses IFB for ingress rate limiting
#!/bin/sh
# Wonder Shaper
# please read the README before filling out these values
#
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits. Also set the device that is to be shaped.
# All config needs to be done in /etc/config/wshaper
#. /lib/functions.sh
@nullivex
nullivex / stats.js
Last active August 29, 2015 13:58
Example JS stat bucket roller
'use strict';
var statTracker = function(interval){
if(!interval) interval = 60000
//hits (would be stored in mongo
var hits = {total: 0, hour: 0, day: 0, month: 0}
//last counters
var last = {hour: 0, day: 0, month: 0}
//previous time increments
@nullivex
nullivex / Testing ActionHero.md
Last active December 30, 2015 10:39
Testing ActionHero; I used Mocha for the testing framework and Chai for the assertion library -- http://actionherojs.com

Testing ActionHero

I used Mocha for the testing framework and Chai for the assertion library.

See http://actionherojs.com for ActionHero information.

Folder Structure

  • test
  • actions
@nullivex
nullivex / 0-NPM-Style-WebStorm.md
Last active December 26, 2015 15:49
Webstorm NPM Style, MyBlackBoard

NPM Style WebStorm 7

If you are attempting the follow the NPM style coding guidelines these configurations may help you get up and running.

There are a couple standalone files

  • MyBlackBoard.icls - this is a modified blackboard color scheme modded to work with Terminus font
  • npm-style.xml - this is a code styling guide that matches as much of NPM coding guidelines as possible
  • settings.jar - My entire settings export useful for first time setup.
@nullivex
nullivex / README.md
Last active February 8, 2022 19:57
Windows 7 64bit, NodeJS 32bit, MongoDB, Mongoose, Bcrypt, SocketIO, Canvas, Git

Windows NodeJS Stack

This took me several hours to figure out so I figured it was worth writing down.

Hopefully this step by step can be used to get node running locally without a lot of problems that are commonly ran into.

Downloads

Update July 7th 2014 - Updated most of the versions including not pointing to the heartbleed version of OpenSSL

@nullivex
nullivex / push_pkg.sh
Created March 27, 2013 03:58
Push LSS packages from composer tree
#!/bin/bash
pkg="$1"
cd $1
#check for untracted files
if [ $(git status | grep -i "Untracked files" | wc -l) -gt 0 ]; then
echo "Untracked files cant push"
exit
@nullivex
nullivex / autocommit.sh
Last active December 15, 2015 11:18
LSS Package Release Scripts
#!/bin/bash
msg=$1
commit() {
for line in $1; do
echo "Committing $line"
cd $line;
git commit -a -m "$2"
cd ..