Skip to content

Instantly share code, notes, and snippets.

View stovak's full-sized avatar
😀

Tom Stovall stovak

😀
View GitHub Profile
<!doctype html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="node_modules/yamljs/dist/yaml.js"></script>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<pre>
@stovak
stovak / Cart.js
Last active August 29, 2015 14:25
'user strict';
var Cart = {};
(function($){
if (Cart) {
jQuery.extend(Cart, {
config: function(config) {
if (!this.config) {
@stovak
stovak / gist:0c193cd5a285c1caea43
Created July 17, 2015 16:46
Parse Apple HealthKit export.xml
#!/usr/bin/env php
<?php
class RecordFile {
var $parser;
var $records = [];
function __construct($filename = null) {
#!/usr/bin/php
<?php
if (!class_exists("OutputWriter")) {
// To write to log file, include this file
// with OutputWriter already defined.
class OutputWriter {
function write($message) {
echo $message;
<?php
/*
* @file
*/
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
From 123e77bfa8983a27fe873a31868bfff83d548929 Mon Sep 17 00:00:00 2001
From: Tom Stovall <[email protected]>
Date: Wed, 13 May 2015 11:51:53 -0700
Subject: [PATCH] D7 backport: MySQL driver does not support full UTF-8
(emojis, asian symbols, mathematical symbols)
---
includes/database/mysql/database.inc | 9 ++++++---
includes/database/mysql/schema.inc | 4 ++--
2 files changed, 8 insertions(+), 5 deletions(-)
@stovak
stovak / gist:d093eb80a10460bc2afe
Last active August 29, 2015 14:20
convert drupal utf8 tables to utf8mb4
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
$button = '<button data-sku="000-00002" class="magento-token-add-to-cart btn btn-default magento-token-add-to-cart-processed" id="magento-token-add-to-cart-000-00002">Add To Cart</button>';
$xmlOpeningString = '<?xml version="1.0" standalone="yes"?>';
$parsed = new SimpleXMLElement($xmlOpeningString.$button);
var_dump((string)$parsed);
// string(11) "Add To Cart"
var_dump((string)$parsed == "Add To Cart");
// false DOH!
'use strict';
/*global $:false */
/*global FastClick:false */
/*jshint unused:vars */
/*jshint quotmark:false */
angular.module('license')
.controller('NameCheck', ['$scope', '$window', 'License', '$http', '$modal',
function ($scope, $window, License, $http, $modal) {
@stovak
stovak / lamp_stack.sh
Last active August 29, 2015 14:02
Install Hopebrew LAMP stack
#!/bin/bash
export PROFILE_PATH=<<-'PROFILE'
export PATH=$HOME/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:$PATH
PROFILE
case $1 in
install)
export homebrew=`which brew`