Skip to content

Instantly share code, notes, and snippets.

View Twipped's full-sized avatar
🗯️
Cursing out Typescript

Jocelyn Badgley Twipped

🗯️
Cursing out Typescript
View GitHub Profile
prod/live
prod/master -> beta server

dev/uat     -> uat server
dev/master  -> dev server
dev/3000
dev/3001
dev/3002
dev/...
@Twipped
Twipped / Output
Last active August 29, 2015 14:08
Why doesn't test() optimize?
[deoptimize context: 1d440be414b1]
[disabled optimization for test, reason: bad value context for arguments value]
Function test(1, 2) is not optimized
@Twipped
Twipped / a.js
Last active August 29, 2015 14:08
#!/usr/bin/env node --trace_opt --trace_deopt --allow-natives-syntax
var optimized = require('optimized');
function test () {
var ai = 0, al = arguments.length, args = al && new Array(al) || [];
if (al) for(; ai < al; ai++) args[ai] = arguments[ai];
return args;
}
@Twipped
Twipped / Box-Draw-Scriptlet.markdown
Created December 9, 2014 02:09
Box Draw Scriptlet

Box Draw Scriptlet

Simply jquery code for drawing boxes on an image that store their coordinates into hidden inputs for form submit.

A Pen by Jarvis Badgley on CodePen.

License.

@Twipped
Twipped / gist:2945df2514b0a0c04b77
Last active August 29, 2015 14:11
Edited excerpt from Freenode#node.js
owen1: what is the reason that almost everything in node is async?
myndzi: async because that's the point of having a single threaded event loop system
owen1: so since node just uses javascript, even if ryan wanted to make it sync, it would be impossible?
myndzi: it's possible to make synchronous functions in node, but it would pretty much defeat the purpose
myndzi: it's kind of like asking "why aren't you using asparagus in this apple pie?"
myndzi: it's not like you can't bake an asparagus pie, it's more like why would you want to? :P
@Twipped
Twipped / mashli.conf
Created April 13, 2015 17:14
Mashli upstart script
# This is an upstart (http://upstart.ubuntu.com/) script
# to run the node.js server on system boot and make it
# manageable with commands such as
# 'start node-app' and 'stop node-app'
#
# This script is to be placed in /etc/init to work with upstart.
#
# Internally the 'initctl' command is used to manage:
# initctl help
# initctl status node-app
sudo su vagrant -c 'curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | bash'
sudo su vagrant -c '. ~vagrant/.nvm/nvm.sh;nvm install v0.10'
sudo su vagrant -c '. ~vagrant/.nvm/nvm.sh;nvm use v0.10'
sudo su vagrant -c '. ~vagrant/.nvm/nvm.sh;nvm alias default v0.10'
function makeSequence(test, closures) {
return function () {
if (!closures.length) {
test.ok(false, 'Sequence was invoked too many times.');
throw new Error('Sequence was invoked too many times.');
}
test.ok(true, 'Sequence stepped');
return closures.shift().apply(this, arguments);
};
}
@Twipped
Twipped / gist:c7ed2a2db00fdbfb76a9
Last active August 29, 2015 14:24
Problem: Identifying identical events on different IRC connections

Say you have a process that is connected to two or more different IRC servers running on the same network, and you want to aggrigate events on both servers into a single stream.

Due to latency within the network, events may arrive from both servers in different order and at different times. The events look identical in how they arrive, and may be identical to simmilar events occuring at another time (eg, a user joins, parts and re-joins, producing two identical join events).

How do you reconcile the streams?

<Kindari> "JAWS: The Javascript + AWS Stack – A monstrously scalable, server-free, web application boilerplate using bleeding-edge AWS services..."
<Kindari> "server-free" !?
<Kindari> wtf
<Kindari> thats not how this works
<Kindari> thats not how any of this works!