Skip to content

Instantly share code, notes, and snippets.

View bmatusiak's full-sized avatar
👌
Having Fun

Bradley Matusiak bmatusiak

👌
Having Fun
View GitHub Profile
@bmatusiak
bmatusiak / pdfPageCount.js
Created September 6, 2012 09:12
pdfPageCount.js
var fs = require("fs");
var ext = "pdf";
var fileName = './out.pdf'.toLowerCase();
var fileNameNoEXT = fileName.replace("."+ext,"");
fs.readFile(fileName,"utf8", function (err, data) {
if (err) throw err;
data = data.split("endobj")
for(var i in data){
if(data[i].indexOf("/Count") >= 0){
@bmatusiak
bmatusiak / Output
Created October 25, 2012 18:49
My Class Concept
SlaveClass 1constructor lol
SlaveClass 2constructor lol
SlaveClass 3constructor lol
SlaveClass v1.3
SlaveClass a
SlaveClass b
SlaveClass c
{}
@bmatusiak
bmatusiak / extend.js
Created October 28, 2012 05:18
My Class Concept2
Function.prototype.extend = function(_class, subClass) {
if (!subClass) {
return _Class(Object, _class);
}
else {
return _Class(_class, subClass);
}
};
function _Class(parent, child) {
@bmatusiak
bmatusiak / css.js
Created November 5, 2012 21:59
requirejs plugin
define(function() {
function css(file) {
this._file = file;
this.element = css.lookfor(this._file);
if (!this.element) {
this.element = document.createElement("link");
this.element.setAttribute("rel", "stylesheet");
this.element.setAttribute("type", "text/css");
this.element.setAttribute("href", this._file);
}
@bmatusiak
bmatusiak / app.js
Created November 14, 2012 03:38
express/mongodb socket.io/redis AIO
/**
* Session Storage for multi servers ex.Heroku stacks
* for expressjs socket.io with databases redis and mongodb
* (redis/socket.io)
* (mongodb/expressjs)
*
* Bradley Matusiak @ 2012 bmatusiak@gmail.com
*
* ref:bunch of searches from google
**/
@bmatusiak
bmatusiak / c9kill.sh
Created November 15, 2012 04:42
c9kill for hanging process
ps -ef | grep node | grep -v grep | grep -v "vfs-worker" | grep -v "bin/node -e (" | awk '{print $2}' | xargs kill -9
@bmatusiak
bmatusiak / wrapRequreJS.js
Created November 15, 2012 20:58
requirejs wrapper for file directory in / out
var fs = require("fs");
var inPath = __dirname + "/in";
var outPath = __dirname + "/out";
fs.readdir(inPath, function(err, files) {
if (err) throw err;
for (var i in files) {
fs.readFile(inPath + "/" +files[i], doWrap(files[i]));
}
});
@bmatusiak
bmatusiak / git.js
Created November 24, 2012 19:29
Git CLI to NodeJS
var procman = require("./procman.js");
module.exports = function(uri){
return new git(uri);
};
function git(uri){
this.uri(uri);
this.RunOptions = {};
}
@bmatusiak
bmatusiak / inline.js
Created November 24, 2012 21:45
inline async js
module.exports = function inline(functions){
/*
,function(next,done){
//
next();
}
*/
functions.reverse();
return function(done) {
@bmatusiak
bmatusiak / README.md
Created November 26, 2012 01:41
How to Check to see if your project running in cloud9

OK.. This is a quick and dirty how to check if your project in running in the c9.io ...

When you have c9.io's IDE open and you go to terminal.

type echo $C9_PID .

If you notice it shoots our a number. This is your project id that c9 uses for there internal id system

This env var is global to every nodejs app that gets ran from ide.