Skip to content

Instantly share code, notes, and snippets.

@craigdmckenna
craigdmckenna / sqlalchemy_mysql_binary_uuid.py
Last active January 15, 2023 21:22
SQLAlchemy, MySQL 16 bit UUID, Custom Data Type
import UUID
from sqlalchemy.dialects.mysql import BINARY
from sqlalchemy.types import TypeDecorator
class BinaryUUID(TypeDecorator):
'''Optimize UUID keys. Store as 16 bit binary, retrieve as uuid.
inspired by:
http://mysqlserverteam.com/storing-uuid-values-in-mysql-tables/
@craigdmckenna
craigdmckenna / gulpfile.js
Last active June 28, 2020 21:09
Create Multiple JavaScript Bundles with rollup and gulp
const gulp = require('gulp')
const gutil = require('gulp-util')
const rollup = require('./rollup')
const jsModules = [
{
entry: 'src/js/main.js',
dest: 'dist/js/main.min.js'
},
{
@craigdmckenna
craigdmckenna / index.html
Last active August 7, 2016 05:10 — forked from RubaXa/index.html
for-in vs. Object.keys vs. Сached keys vs. rorEach vs. while (http://jsbench.github.io/#22211482bdf21f09ca4a366227857af0) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>for-in vs. Object.keys vs. Сached keys vs. rorEach vs. while</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
// Tested on Node REPL v4.0.0
"use strict";
const tests = {
case1: {
name: 'Case 1',
string: 'Automotive',
expect: 'A6e'
},
@craigdmckenna
craigdmckenna / HTML5 snippet
Created December 3, 2015 18:58
HTML5 basic document template- A snippet for Visual Studio Code
"HTML5": {
"prefix": "html",
"body": [
"<!DOCTYPE html>\n",
"<html lang=\"en\">",
"<head>",
"\t<meta charset=\"utf-8\">\n",
"\t<title>${title}</title>",
"\t<meta name=\"description\" content=\"${description}\">\n",