Skip to content

Instantly share code, notes, and snippets.

converting ideas to code

Roni Nes FLasH3r

converting ideas to code
View GitHub Profile
remy / gist:350433
Created Mar 31, 2010
Storage polyfill
View gist:350433
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
expires = "; expires="+date.toGMTString();
hagenburger / javascript_loader.js
Created Jul 30, 2010
Dynamically load JavaScript files with callback when finished
View javascript_loader.js
// Example:
// With callback (that’s the good thing):
JavaScript.load("", function() {
API.use(); // or whatever api.js provides ...
eduardocereto / cb_addEventListener.js
Created May 4, 2011
a cross-browser implementation of addEventListener/AttachEvent without external dependencies
View cb_addEventListener.js
* Cross Browser helper to addEventListener.
* @param {HTMLElement} obj The Element to attach event to.
* @param {string} evt The event that will trigger the binded function.
* @param {function(event)} fnc The function to bind to the element.
* @return {boolean} true if it was successfuly binded.
var cb_addEventListener = function(obj, evt, fnc) {
// W3C model
jonleighton / base64ArrayBuffer.js
Last active Sep 15, 2022
Encode an ArrayBuffer as a base64 string
View base64ArrayBuffer.js
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
romannurik / inline_worker_with_fallback.html
Created May 24, 2011
An example of using simple inline Web Workers with a fallback for browsers that can't support this technique.
View inline_worker_with_fallback.html
<!DOCTYPE html>
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
joelambert / README
Created Jun 1, 2011
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
kn0ll / bookmarklet.js
Created Jun 11, 2011
advanced bookmarklet template
View bookmarklet.js
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
necolas / snippet.js
Created Jun 14, 2011
Optimised async loading of cross-domain scripts
View snippet.js
* Updated to use the function-based method described in
* Better handling of scripts without supplied ids.
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
View Cookie.js