Skip to content

Instantly share code, notes, and snippets.

@sTiLL-iLL
sTiLL-iLL / index.html
Last active August 29, 2015 14:15
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>
@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 / 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;
/**
* 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 / kacher.js
Last active August 29, 2015 14:10
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: [],
@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 / 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 / KNDmitter.js
Last active August 29, 2015 14:08
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 / brioWifiModule.js
Last active August 29, 2015 14:07
brioWIFImodule.js
define(['knockout', 'jquery'], function (ko, $) {
return function (wifiInfo, wifiNetworks, SSIDList) {
var slf = this, SKT = skt || io.connect(), WifiInfo = wifiInfo || {},
wirelessCollection = ko.observableArray(wifiNetworks) || ko.observableArray([]),
ssidCollection = ko.observableArray(SSIDList) || ko.observableArray([]), Abstract = {
isConnected: false,
BrioSSID: ko.observable(),
BrioPassword: ko.observable(),
BrioSecurityType: ko.observable(999),
@sTiLL-iLL
sTiLL-iLL / XHR.js
Last active February 27, 2023 18:09
XHR and fallback
// simple request with a fallback
function getXHR() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
try {
return new ActiveXObject('MSXML2.XMLHTTP.6.0');
}