Skip to content

Instantly share code, notes, and snippets.

// caching script fetcher //
var futrs = {};
var ajaxFetch = function( url, cBak ) {
if ( !futrs[ url ] ) {
futrs[ url ] = $.Deferred(function( defer ) {
$.getScript( url )
.then( defer.resolve, defer.reject );
@sTiLL-iLL
sTiLL-iLL / KND_Index.js
Last active August 29, 2015 14:03
HTTP STREAMING SERVER... KNDsrvr.js... javascript for Node.js
// programatic entry point for the server //
var router = require('./router.js'),
requestHandlers = require('./requestHandlers.js'),
webServer = require('./server.js'),
handle = {};
// Unary referencing... each function maps -to- a specific request/params/method etc... //
handle['/'] = handle['/home'] = handle['/Home'] = handle['/index.html'] = handle['/Index.html'] = requestHandlers.startRoot;
@sTiLL-iLL
sTiLL-iLL / index.html
Last active August 29, 2015 14:04
Simple position tracker
<!Doctype html>
<meta name="viewport" content="width=620" />
<title>KnD-MApPA</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<article>
<p>Finding You...: <span id="status">Checking...</span>
</p>
</article>
<script>
var map = "",
@sTiLL-iLL
sTiLL-iLL / blobStorage.js
Last active August 29, 2015 14:04
blobs in the IndexDB
// make a blob
var blob = new Blob(['blobyJo'], {
type: 'text/plain'
});
try {
var store = db.transaction(['buckets'], 'readwrite')
.objectStore('buckets');
var fngr = store.put(blob, 'blob');
@sTiLL-iLL
sTiLL-iLL / OP_NS.js
Last active August 29, 2015 14:05
Object Pool microframework
(function (context) {
var createKontxt = function (nameStr, baseLine) {
var x, j, r, baseKnTxt, name;
var wdgts = nameStr.split('.');
j = baseKnTxt = baseLine ? baseLine : (Function('return this')());
var events = (function(){
var topics = {};
return {
subscribe: function(topic, listener) {
if(!topics[topic]) topics[topic] = {
queue: []
};
@sTiLL-iLL
sTiLL-iLL / EventEmitterPattern.js
Last active August 29, 2015 14:05
An example of inheriting from event emitter
// Require our emitter
var Emitter = require('events').EventEmitter;
// Our main constructor
var myEmitter = function (config) {
// extend with emitter
Emitter.call(this);
};
@sTiLL-iLL
sTiLL-iLL / dialogz.html
Last active August 29, 2015 14:05
html5 dialog snips
<!doctype html>
<html>
<head>
<title>Dialog Test</title>
<style>
dialog::backdrop {
background: rgba(255, 0, 255, 0.25);
}
</style>
</head>
@sTiLL-iLL
sTiLL-iLL / debounce.js
Created August 25, 2014 01:33
A load balancing function.... debounce()
/*
The debounce method returns a function which wraps your callback,
limiting its execution rate to the limit specified in the second argument.
Now your frequent callbacks can't brick the user's browser!
*/
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
@sTiLL-iLL
sTiLL-iLL / seshCache.js
Last active August 29, 2015 14:05
Simple caching inside of session storage...
// session storage caching
define(function() {
var cacheObj = window.sessionStorage || {
getItem: function(key) {
return this[key];
},
setItem: function(key, value) {