Skip to content

Instantly share code, notes, and snippets.

View jeremyboggs's full-sized avatar

Jeremy Boggs jeremyboggs

View GitHub Profile
@edsu
edsu / dc-trends.txt
Last active November 28, 2016 16:45
get trending hashtags on the command line with twarc and jq....
@kriskelly
kriskelly / routing.php
Last active December 21, 2015 14:02
Routing file for running Omeka 2.x on a PHP dev server.
<?php
// You can run this like so:
// cd path/to/your/omeka/installation
// php -S localhost:5000 routing.php
// Stackoverflow: http://stackoverflow.com/questions/834303/startswith-and-endswith-functions-in-php
function endsWith($haystack, $needle) {
// search forward starting from end minus needle length characters
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);
@voxpelli
voxpelli / SASS_Color_Contrast.md
Last active August 21, 2022 11:49
Pure SASS script for calculating contrast ratios of colors. MOVED TO: https://github.com/voxpelli/sass-color-helpers

Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.

This script currently lacks the support for alpha-transparency that Lea supports in her script though.

In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.

Normal usage: `color: pick_best_color(#f00

@waynegraham
waynegraham / console.js
Last active October 16, 2022 19:03
print console.log output to a debug div (for mobile)
if (typeof console != "undefined")
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function() {};
console.log = function(message) {
console.olog(message);
$('#debugDiv').append('<p>' + message + '</p>');
};
@waynegraham
waynegraham / gist:883062
Last active September 25, 2015 07:08
mysql database dump
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ~/Desktop/`date +%Y-%m-%d-%T`.sql.gz
mysqldump -h [host] -u [user] --password=[password] [database] | gzip -c | cat > ./`date +%Y-%m-%d-%T`.sql.gz
// Remove scripts from the wp script queue:
// credit http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles
function rv_deregister_javascript() {
wp_deregister_script('comment-reply');
wp_deregister_script('l10n');
}
// Replace jQuery 1.4.4 with 1.5 on the frontend
// as seen on http://codex.wordpress.org/Function_Reference/wp_enqueue_script
// Do not do this on the wp-admin, jQuery 1.5 might break functionality at this point (March 2011)
@paulirish
paulirish / gist:854293
Created March 4, 2011 07:18
jQuery unserialize Form plugin
// Unserialize (to) form plugin - by Christopher Thielen
// adapted and desuckified (a little) by Paul Irish
// takes a GET-serialized string, e.g. first=5&second=3&a=b and sets input tags (e.g. input name="first") to their values (e.g. 5)
(function($) {
$.fn.unserializeForm = function(values) {