Skip to content

Instantly share code, notes, and snippets.

View regentking's full-sized avatar

Eric Hollbach regentking

View GitHub Profile
@Yaffle
Yaffle / websql.php
Last active April 30, 2020 18:52
Web SQL Database API for PHP
<?php
/* usage:
$db = new Database("mysql:host=" . Config::$dbHost . ";dbname=" . Config::$dbName . ";", Config::$dbName, Config::$dbUser, Config::$dbPass);
$db->changeVersion("", "1", function ($tx) {
$tx->executeSql("CREATE TABLE IF NOT EXISTS `examples` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`example` mediumtext,
PRIMARY KEY (`id`)
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
var moment = require('moment');
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
@CodaFi
CodaFi / Accelerando
Last active December 14, 2015 17:38
ACCELERATE(x) _mm_set1_ps((float)&x)
DECCELERATE_INTO(x, f) _mm_store_ss(&f, result)
Sample usage:
//accelerate a float into a super-fast 128 mm register
float x = 1.0f;
__m128 vecX = ACCELERATE(x);
//deccelerate a 128 mm register value back to a float
@bradwright
bradwright / websockets-server.js
Created June 11, 2011 23:29
Pure Node.js WebSockets server
/*
* node-ws - pure Javascript WebSockets server
* Copyright Bradley Wright <brad@intranation.com>
*/
// Use strict compilation rules - we're not animals
'use strict';
var net = require('net'),
crypto = require('crypto');
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);