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
$(document).ready(function() { | |
/*------------------------------------------------------------------- | |
| Force external links and specific files to open in a new window/tab | |
*-------------------------------------------------------------------*/ | |
var externalProtocolRegex = /^https?:\/\//i; | |
var externalRegex = (window.location.protocol + '//' + window.location.hostname).replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); | |
externalRegex = new RegExp('^(\/\/|' + externalRegex + ')'); | |
var fileRegex = /\.pdf$/; | |
$('a[href!=""]').not('[target=_blank]').click(function(event) { |
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
add_action('admin_init', function() { | |
if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') { | |
wp_redirect(home_url()); exit; | |
} | |
}); |
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
add_action('after_setup_theme', function() { | |
if (!current_user_can('administrator') && !is_admin()) { | |
show_admin_bar(false); | |
} | |
}); |
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 | |
class CsvArray | |
{ | |
protected $data; | |
protected $delimiter; | |
protected $enclosure; | |
protected $forceEnclosement; | |
public function __construct($data = array(), $delimiter = ',', $enclosure = '"', $forceEnclosement = false) |
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
if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) { | |
var viewportmeta = document.querySelector('meta[name="viewport"]'); | |
if (viewportmeta) { | |
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0'; | |
document.body.addEventListener('gesturestart', function () { | |
viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6'; | |
}, false); | |
} | |
} |
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
require 'pony' | |
raise 'Please specify an email file path' if ARGV.count < 1 | |
html = File.open(ARGV[0]) | |
Pony.mail( | |
:to => 'to@example.com', | |
:from => "from@example.com", | |
:subject => 'Email Test', |
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 | |
function time_to_seconds($time = 0) | |
{ | |
list($secs, $mins, $hours) = array_pad(array_reverse(explode(':', $time)), 3, 0); | |
return ($hours * 3600) + ($mins * 60) + $secs; | |
} |
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
beep 1 | |
set passwd to "" | |
display dialog "Please enter your user password" default answer "" | |
set passwd to text returned of result |
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
export COPYFILE_DISABLE=true && tar -czvf tarball.tar.gz --exclude='.DS_Store' --exclude='._*' --exclude='Thumbs.db' --exclude='.git' --exclude='.git*' /path/to/archive |
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
export COPYFILE_DISABLE=true && tar -czvf tarball.tar.gz --exclude='.DS_Store' --exclude='._*' --exclude='Thumbs.db' /path/to/archive |