Skip to content

Instantly share code, notes, and snippets.

View NuckChorris's full-sized avatar

Emma Lejeck NuckChorris

View GitHub Profile
[Jul 19th, 2011 / 22:25:18] ** Topic changed by dxd on 07/15/11 21:30 GMT
[Jul 19th, 2011 / 22:25:18] ** Title changed by dxd on 07/15/11 21:31 GMT
[Jul 19th, 2011 / 22:25:18] <hoodlum-girl-rox> how can we tell if we're already in #backstage pass? srry, I'm a noob at this
[Jul 19th, 2011 / 22:25:22] <SaTaNiA> kouiskas: :thumb89128169: Gilles
[Jul 19th, 2011 / 22:25:25] <aMoniker> o hai
[Jul 19th, 2011 / 22:25:25] ** blackshadow148 has left (connection closed)
[Jul 19th, 2011 / 22:25:26] <aMoniker> I grew it myself
[Jul 19th, 2011 / 22:25:27] <PrairieEagle> 5 more minutes, someone start the count down!
[Jul 19th, 2011 / 22:25:28] <knightar> Danium: God I hope not, if that story is true
[Jul 19th, 2011 / 22:25:29] ** jekor has joined
javascript:(function(){ MiddleMan.Commands.bind("welcome", 1, function (args) { MiddleMan.dAmnSend.msg(false, "<sub>:party: <b>" + args + ":</b> Wanna be a ninja? Well, then press \"<code>F5</code>\" (reload) so we can recruit you! Together, we can beat these gay-ass unicorns!</sub>"); }); MiddleMan.Commands.bind("haider", 1, function (args) { MiddleMan.dAmnSend.msg(false, "<sub> :party: <b> " + args + ": Congratulations on becoming a Ninja, you're already looking smarter than Naruto. Read <a href=\"http://news.deviantart.com/article/157268/\">this</a> and get started beating those fucking unicorns!</sub>"); }); MiddleMan.Commands.bind("pcsay", 1, function (msg) { usersInPC = new Array(); var args = msg.split(" "); var argsE = new Array(); $.each(args, function (key, val) { argsE.push(msg.split(" ").slice(key).join(" ")); }); $.each(MiddleMan.getChannel().members.members, function (key, val) { if (this.info.pc.toLowerCase() == args[0].toLowerCase()) { usersInPC.push(this.name); } }); MiddleMan.dAmnSend.msg
//app.js
var express = require('express@2.2.2'),
connect = require('connect@1.3.0'),
...
//packages json
"dependencies": {
"express": "2.2.2"
var regex = /\{([a-zA-Z\.0-9]*)\}/mg;
var getObject = function (obj, str) {
var parts = str.split('.');
for (var i = 0, l = parts.length; i < l; ++i) {
if (!obj[parts[i]] || obj[parts[i]] === null) {
return null;
}
obj = obj[parts[i]];
}
@NuckChorris
NuckChorris / Parse.js
Last active September 27, 2015 05:18
module.exports = function Parse (template, obj) {
if (arguments.length === 1) {
return template;
} else if (arguments.length === 2) {
if (arguments[1] == null) {
return template;
} else if (typeof arguments[1] === 'object') {
var obj = arguments[1];
} else if (typeof arguments[1] === 'Array') {
var obj = arguments[1];
Testing Cache Misses (x50)
...................................................
Total: 853ms
Average: 17.06ms
Testing Cache Hits (x50)
...................................................
Total: 165ms
Average: 3.3ms
require.extensions['.json'] = function (module, filename) {
var content = require('fs').readFileSync(filename, 'utf8');
module.exports = JSON.parse(content);
};
npm ERR! error installing haibu@0.4.6-1 Error: Not found: hook.io@'>=0.6.0- <0.7.0- >=0.6.0'
npm ERR! error installing haibu@0.4.6-1 Valid install targets:
npm ERR! error installing haibu@0.4.6-1 ["latest"]
npm ERR! error installing haibu@0.4.6-1 at installTargetsError (/opt/node/lib/node_modules/npm/lib/cache.js:412:10)
npm ERR! error installing haibu@0.4.6-1 at /opt/node/lib/node_modules/npm/lib/cache.js:405:17
npm ERR! error installing haibu@0.4.6-1 at saved (/opt/node/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:136:7)
npm ERR! error installing haibu@0.4.6-1 at cb (/opt/node/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:36:9)
npm ERR! Error: Not found: hook.io@'>=0.6.0- <0.7.0- >=0.6.0'
npm ERR! Valid install targets:
npm ERR! ["latest"]
@NuckChorris
NuckChorris / config.js
Created October 20, 2011 22:29
PHP var_export() reading in Node.js
var sys = require('sys');
var fs = require('fs');
var parseConfigFile = function (str) {
str = str.replace('<?php', '');
str = str.replace('?>', '');
str = str.replace(';', '');
str = str.replace('return ', '');
str = str.replace(/'([a-zA-Z0-9\_\-]+)'\s+=>\s/g, '"$1": ');
str = str.replace(/array \(/g, '{');
var fs = require('fs');
var __ = require('underscore');
var Config = require('./config.js');
var DIR = '/home/xbmc/LKB2/storage/mod/ChatLlama/';
var emotes_config = new Config(DIR + 'emotes.bsv');
exports.emotes = {};
emotes_config.on('load', function (data) {
exports.emotes = data;