This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Turn decimals into fractions. | |
*/ | |
function dec2frac($f) { | |
$base = floor($f); | |
if ($base) { | |
$out = $base . ' '; | |
$f = $f - $base; | |
} | |
if ($f != 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL... | |
mysql -uroot -proot tableau_pantheon_www -e "select cid, LENGTH(data) as length_data, serialized, expire, created INTO OUTFILE '/Users/***USER***/Documents/Tableau/form_cache_size-local.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' from cache_form" | |
LOCAL WITH OUT OUTFILE... | |
mysql -uroot -proot tableau_pantheon_www -e "select cid, LENGTH(data) as length_data, serialized, expire, created from cache_form" > /Users/jlind/Documents/Tableau/form_cache_size-local.txt | |
REMOTE... | |
mysql -upantheon -p***PASS*** -h dbserver.live.***HASH***.drush.in -P ***PORT*** pantheon -e "select cid, LENGTH(data) as length_data, serialized, expire, created from cache_form" > /Users/***USER***/Documents/Tableau/form_cache_size-live.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Main things to keep in mind, since they're hard to believe... | |
1. Only use inline style. | |
2. Just give in and nest tables. It's terrible, but reliable everywhere. | |
3. Margin and padding is not completely supported (depending on DOM element). | |
Mostly just not Outlook > 2003, which is insane. | |
4. Apply style to divs and not many other tags. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
GOLDEN_DOMAIN="example.com" | |
PROBLEM="$(cat /etc/hosts | grep $GOLDEN_DOMAIN | grep -v '^#' | wc -w)" | |
if [ "$PROBLEM" -gt 0 ]; then | |
say omg fix yer hosts | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Utility function to agnosticly get the current menu object. | |
* Structured like menu_get_object(), but the passed type will be set for you. | |
* | |
* @param string (reference) $return_type | |
* | |
* return object | |
* Entity object of current menu callback page. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collection = function (obj) { | |
// Private vars. | |
var keyList = null, | |
length = null; | |
// Public functions. | |
return { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get image colors (cross origin fun). | |
$(window).load(function() { | |
var canvas = document.createElement('canvas'), | |
ctx = canvas.getContext("2d"); | |
bgColor, | |
$image; | |
canvas.width = 50; | |
canvas.height= 50; | |
$('#card-deck .card img').each(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Send the request to retrigger a build. | |
* | |
* @param int $build_id | |
* Travis build id to act upon, for URL construction. | |
* @param string $token | |
* Travis user authorization token. | |
* @return array | |
* Response items the calling function(s) might care about. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.page { display:none; } | |
</style> | |
<script> | |
function addEvent(elem, event, fn) { | |
if (elem.addEventListener) { | |
elem.addEventListener(event, fn, false); | |
} else { | |
elem.attachEvent('on' + event, function() { | |
// set the this pointer same as addEventListener when fn is called |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Data transforms due to version updates. | |
*/ | |
function schema() { | |
// Update keys. | |
var keys = { | |
'MY-NEW-KEY': {'oldKey': 'MY-OLD-KEY', 'version': '0.2.0'} | |
}; | |
for (var newKey in keys) { |
OlderNewer