Skip to content

Instantly share code, notes, and snippets.

View reqshark's full-sized avatar
🪂
ridge soaring

Bent Cardan reqshark

🪂
ridge soaring
View GitHub Profile
@reqshark
reqshark / manifest.js
Created March 5, 2014 03:30
manifest for leveldb
{ methods:
{ createReadStream: { type: 'readable' },
readStream: { type: 'readable' },
createValueStream: { type: 'readable' },
valueStream: { type: 'readable' },
createKeyStream: { type: 'readable' },
keyStream: { type: 'readable' },
createWriteStream: { type: 'writable' },
writeStream: { type: 'writable' },
isOpen: { type: 'sync' },
@reqshark
reqshark / wtf.js
Created March 7, 2014 04:21
heap your shit together
process.memoryUsage()
@reqshark
reqshark / while.js
Created March 7, 2014 07:11
while years before my birth given to the console object, fire back into our interface by log
var i=0;
while(i<=1984){console.log(i);i++;};
@reqshark
reqshark / os_compliance.sh
Created March 8, 2014 07:27
all the vim bs in one place so I can remember
#h move one character left
#j move one row down
#k move one row up
#l move one character right
w move to beginning of next word
#b move to beginning of previous word
#W move to beginning of next word after a whitespace
#B move to beginning of previous word before a whitespace
#E move to end of word before a whitespace
@reqshark
reqshark / package.json
Created March 12, 2014 21:17
my package.json
{
"dependencies":{
"zmq":"*",
"oauth":"*",
"JSONStream":"*",
"event-stream":"*",
"request":"*",
"levelup":"*",
"memdown":"*",
"level-live-stream":"*",
@reqshark
reqshark / switcher.js
Created March 28, 2014 23:31
obtain string equality faster and just switch all cases until default
//read base64 encoded image strings into node.js application memory...
//if too lazy for RegEx, just split method off random unpredictable mime-types
var mimeyType = base64Image.split(';')[0].split(':')[1];
var url = '/unique/static/content/image/id/cool';
switch(mimeyType) {
case 'image/jpg':
writeBuffer(new Buffer(base64Image.replace(/^data:image\/\w+;base64,/,''),'base64'),url+'.jpg');
break;
@reqshark
reqshark / informative.sh
Last active August 29, 2015 14:00
info
git clone git@github.com:reqshark/bash-git-prompt.git .bash-git-prompt
echo -e "source ~/.bash-git-prompt/gitprompt.sh" >> ".bashrc"
if [ -f $HOME/.bashrc ]; then
. $HOME/.bashrc
fi
@reqshark
reqshark / pub.js
Last active August 29, 2015 14:00
set up the zeromq publisher with Node.js
//node and ØMQ
//coolest, lowest footprint answer to all our network data needs
//getting started
//os is an extra require calling its own core node.js module
//http://nodejs.org/api/os.html#os_os_networkinterfaces
var os = require('os');
//when you install zmq, opt for at least version 3 on your server.
@reqshark
reqshark / services.js
Created April 26, 2014 13:55
the angular + socket.io factory
.factory('socket', ['$rootScope', function ($rootScope) {
var socket = io.connect();
return {
on: function (eventName, callback) {
socket.on(eventName, function () {
var args = arguments;
$rootScope.$apply(function () {
callback.apply(socket, args);
})
})