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
function gzsize { | |
if [[ $1 =~ :// ]]; then | |
real=$(curl -L $1 2>/dev/null | wc -c | xargs) | |
gzipped=$(curl -L $1 2>/dev/null | gzip | wc -c | xargs) | |
else | |
real=$(cat $1 | wc -c | xargs) | |
gzipped=$(cat $1 | gzip | wc -c | xargs) | |
fi | |
compression=$(awk -v a=$real -v b=$gzipped 'BEGIN { printf "%.2f", (1 - b / a) * 100 }') | |
echo "Real: $real" |
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 | |
/** | |
* Convert camel case to snake case. | |
* | |
* DISCLAIMER: Not mine. Got it from {@link http://stackoverflow.com/a/35719689}. | |
* | |
* @param string $camelString The source string. | |
* @return string The converted string. | |
*/ |
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
<?phpunction camel2snake($camelString) | |
{ | |
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $camelString)); | |
} |
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 | |
/** | |
* Convert a snake-cased string to a camel-cased one. | |
* | |
* @param string $snakeString The original snake-cased string. | |
* @param bool $first Whether the first letter should be capitalized | |
* (useful for classnames vs. properties). | |
* @return string The converted string. | |
*/ |
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
'use strict'; | |
var _ = require('lodash'); | |
var consolidate = require('consolidate'); | |
var gutil = require('gulp-util'); | |
var path = require('path'); | |
var through = require('through2'); | |
var File = gutil.File; | |
var PluginError = gutil.PluginError; |
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
{ | |
"$schema": "http://json-schema.org/schema#", | |
"id": "http://advancedcustomfields.com/json-schema/field_group", | |
"type": "object", | |
"definitions": { | |
"empty": { | |
"type": "string", | |
"maxLength": 0 | |
}, | |
"intOrEmpty": { |
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
#!/bin/bash | |
# USAGE: | |
# getwp [-v version] dest | |
# Help screen | |
function usage() | |
{ | |
echo | |
echo "getwp -- Made with <3 by @friartuck6000" |
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
#!/bin/bash | |
# Red Bull for Hard Drives | |
# ------------------------------------------------------------------------ | |
# Run this script once to keep your mounted Time Machine or other external | |
# hard drive(s) from falling asleep and making your system hang every time | |
# the drive wakes up. | |
# | |
# Usage: | |
# 1. Be sure to chmod +x this file before trying to execute it. |
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
(function($) { | |
// Write plugins | |
})(jQuery); | |
jQuery(document).ready(function($) { | |
// Call plugins and do other stuff | |
}); |
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
$.fn.fluidAffix = function(opts){ | |
return this.each(function(){ | |
var $this = $(this); | |
var $parent = $this.parent(); | |
// Match width of parent container | |
$this.css('width', $parent.width()+'px'); |