Skip to content

Instantly share code, notes, and snippets.

View vicapow's full-sized avatar

Victor vicapow

View GitHub Profile
@vicapow
vicapow / DateTimeField
Created June 21, 2011 18:29
datetimefield for qooxdoo
qx.Class.define("project.form.DateTimeField",
{
extend : qx.ui.form.DateField,
construct : function()
{
this.base(arguments);
this.setDateFormat( new qx.util.format.DateFormat("M/d/yy h:mma"));
},
app.use(express.compiler({
src : __dirname + '/views/style'
, dest: __dirname + '/../public/style'
, enable: ['less']
}));
var stream = request('http://example.com/video.mp4'); // doesnt work
var stream = fs.createReadStream(__dirname +'/video.mp4'); // works
var proc = new ffmpeg(stream);
.usingPreset('flashvideo')
.writeToStream(res, function(retcode, err){
if(err) throw err;
console.log('file has been converted succesfully');
});
example_user = {
// a list of 0 or more group ids of the groups this user belongs to
_groups : [_group1ID,_group2ID,...]
// a list of 0 or more roles
, roles : ['user','admin'...]
, fname : 'Some'
, lname : 'User'
, prettyUsername : 'UsEr'
, username : 'user'
, email : 'someuser@example.com'
Good code is innovative
Good code makes a library useful
Good code is aesthetic
Good code makes a library understandable
Good code is unobtrusive
@vicapow
vicapow / my-style.js
Last active October 6, 2015 15:08
Node.JS Style guide
// My first attempt at a style guide:
// 2 character spaces (no tabs!)
// ' > "
// no semis! (yeah, i said it.)
// operators:
// (where foo and bar have been declared previously)
foo = 2
@vicapow
vicapow / gist:3076653
Created July 9, 2012 13:42
who's the master node?
var Hook = require('hook.io').Hook
, is_master = false
var hook = new Hook({
name : 'hook'
, type : 'victor'
, autoheal : true
});
hook.on('*::rank::accepting',function(data){
@vicapow
vicapow / gist:3079325
Created July 9, 2012 22:04
print my source code!
require('fs').createReadStream(process.argv[1]).pipe(process.stdout);
@vicapow
vicapow / gist:3091278
Created July 11, 2012 15:45
leaking memory?
var http = require('http')
, util = require('util')
, pwd = '/Users/victor/Downloads/images'
, fs = require('fs')
, mfds = 1024 // max open file descritors
, ofds = 0
, memwatch = require('memwatch')
, _ = require('underscore')
function copyFiles(){
@vicapow
vicapow / zoo.cfg
Created July 17, 2012 01:31
zookeeper default config
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just