Skip to content

Instantly share code, notes, and snippets.

@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 / 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;
// 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 / GTRX.js
Last active August 29, 2015 14:03
geo locator module
// GTRX geolocator
(function GTRX(window) {
var wndw = window,
var startG = function() {
if (wndw.navigator.geolocation) {
var trxLST = [], pID = "", cnt = 0, ipAddrs = "";
@phusick
phusick / hub.html
Created June 12, 2014 19:37
Event Hub
<html>
<head>
<title>Event Hub</title>
<script src="hub.js"></script>
<script>
var subscription = hub.subscribe('/go', function(params) {
console.log('one', params);
});
var subscription2 = hub.subscribe('/go', function(params) {
console.log('two', params);
@crazy4groovy
crazy4groovy / deviantart-example.js
Last active February 3, 2021 21:13 — forked from NuckChorris/deviant.js
Nodejs sample on how to automate the process of login and grab auth headers/tokens/etc.
var http = require('http');
var https = require('https');
/**
* @name deviant.js
* @author Peter Lejeck <[email protected]>
* @description deviantJS, handles the process of logging in.
* @version 0.1
*/
@sTiLL-iLL
sTiLL-iLL / ajaxPreloader.js
Created August 24, 2013 18:53
ajaxn - ified image preloader... its gewd!
(function() {
var f = [];
$.ajax({
url: "imgz.js",
type: "GET",
contentType: "json",
cache: true,
success: function(data) {
var j = JSON.parse(data);
var $c = $("#container");
@sTiLL-iLL
sTiLL-iLL / custom video embed.js
Last active December 21, 2015 10:28
Generate a embed widget on the fly!
//store the URL
var url = "http://vimeo.com/71673549";
//extract the ID
var rgx = /\/\/(www\.)?vimeo.com\/(\d+)($|\/)/;
//the ID: 71673549
var id = url.match(rgx);
var width = '640';
@sTiLL-iLL
sTiLL-iLL / check if cookies are turned on
Last active December 21, 2015 08:38
more helpful JS functions for your pleasure!
// Check if cookies are enabled
$(document).ready(function() {
var dt = new Date();
dt.setSeconds(dt.getSeconds() + 60);
document.cookie = "cookietest=1; expires=" + dt.toGMTString();
var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1;
if(!cookiesEnabled){
//cookies are not enabled
}
@sTiLL-iLL
sTiLL-iLL / functional js type shit
Created August 20, 2013 09:02
helpful snips O' javascript!
// How to get client ip address with jQuery
$.getJSON("http://jsonip.appspot.com?callback=?",function(data){
alert( "Your ip: " + data.ip);
});
// How to parse XML with jQuery
// file.xml: