Skip to content

Instantly share code, notes, and snippets.

View marcolino's full-sized avatar

Marcolino marcolino

View GitHub Profile
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active April 4, 2024 02:00
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@ChristianUlbrich
ChristianUlbrich / proxy.php
Created September 19, 2013 21:00
php transparent proxy, seems to support full headers BOTH ways and has some nice cookie stuff, worth looking into
<?php
/**
* @filename: proxy.php
*
* Proxy transparent cross-domain
* tranport cookie and headers
* @example
* http://frameinoves/proxy.php?url=http://frameinoves/ola.php"
*
*
@jonathantneal
jonathantneal / Array.move.js
Created September 18, 2012 16:08
Array.move.js
Array.prototype.move || Object.defineProperty(Array.prototype, "move", {
value: function (index, howMany, toIndex) {
var
array = this,
index = parseInt(index) || 0,
index = index < 0 ? array.length + index : index,
toIndex = parseInt(toIndex) || 0,
toIndex = toIndex < 0 ? array.length + toIndex : toIndex,
toIndex = toIndex <= index ? toIndex : toIndex <= index + howMany ? index : toIndex - howMany,
moved;
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');