Skip to content

Instantly share code, notes, and snippets.

@sTiLL-iLL
sTiLL-iLL / KNDmitter.js
Last active March 20, 2025 07:59
Emitter for the browser...
(function () {
'use strict';
function KNDmitter() { }
var proto = KNDmitter.prototype;
var exports = this;
var originalGlobalValue = exports.KNDmitter;
function indexOfListener(listeners, listener) {
var i = listeners.length;
while (i--) {
@sTiLL-iLL
sTiLL-iLL / Signals.js
Last active August 29, 2015 14:10
Signals.js... A fast and efficient event system in javascript.
// SignalsBest2.js 8;]
var Signals = (function() {
'use strict';
var sigCache = {}, singleRtnVal = false,
received = function(eventName, func) {
return wen(eventName, function(evnt) {
return func(evnt);
});
@sTiLL-iLL
sTiLL-iLL / SignalsV2.js
Last active August 29, 2015 14:10
Another version of my "Signals" event system.
// SignalsV2.js
(function () {
'use strict';
function Signals () {};
var exports = this,
@sTiLL-iLL
sTiLL-iLL / kacher.js
Last active March 20, 2025 08:03
kacher.js A basic static resource cache module for node.js
// kacher.js ... this uses my Signals.js event module as a dependency
var signalCaster = require("./signals").Signals,
fs = require('fs'),
url = require("url"),
path = require("path"),
config = {
cache: [],
/**
* Usage: phantomjs scrape.js URL [selector]
* selector defaults to `#content`
*/
var page = require('webpage').create(),
system = require('system');
if (system.args.length < 2 || system.args.length > 3) {
@sTiLL-iLL
sTiLL-iLL / scribbles.js
Last active August 29, 2015 14:12
my nonblocking, threadsafe file writer/appender for nodejs. works great with clustered servers, and child processes that write to shared or static file-stores
//scribbles.js
var fs = require('fs'),
pth = require('path'),
cueMngr = {};
function Scribbles(fileNm) {
this.handle = fileNm;
this.canWrite = false;
@sTiLL-iLL
sTiLL-iLL / embeddedWRKR.js
Created February 1, 2015 11:44
Spin a worker from within the original html/js file!
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
@sTiLL-iLL
sTiLL-iLL / index.html
Last active March 20, 2025 08:01
MVC and Templates... vanilla.js... its a work in progress, but its super light, easy to use, and fast as hell. fast
///////// VIEW //////////////////////////
<!DOCTYPE html>
<html>
<head>
<title>MY MVC</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="stylz.css" />
<script src="signals.js"></script>