- GitHub Staff
- http://astockwell.com
This file contains hidden or 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
var Now; | |
if (typeof performance !== 'undefined' && performance.now) { | |
Now = function() { | |
return performance.now(); | |
}; | |
} else if (Date.now) { | |
Now = function() { | |
return Date.now(); | |
}; | |
} else { |
This file contains hidden or 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
var output = document.getElementById('output'); | |
function assert( outcome, description ) { | |
var li = document.createElement('li'); | |
li.className = outcome ? 'pass' : 'fail'; | |
li.appendChild( document.createTextNode( description ) ); | |
output.appendChild(li); | |
}; |
This file contains hidden or 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
<script> | |
(function(d,s){ | |
var x = d.createElement(s), | |
o = d.getElementsByTagName(s)[0]; | |
x.src="script.js"; // your script here | |
x.async=true; // mostly optional | |
o.parentNode.insertBefore(s,o); // inject | |
})(document,'script'); | |
</script> |
This file contains hidden or 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 | |
#### TO USE #### | |
# 1. Create a new folder for your project | |
# 2. Save this script in that folder (as klas_to_flat.sh) | |
# 3. Run `chmod +x klas_to_flat.sh` to make it executable | |
# 4. Run `./klas_to_flat.sh` | |
#### Smile #### | |
set -eu |
This file contains hidden or 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 | |
/* | |
* VARIABLE FORMATS: | |
* $e_date = '02/10/2012' (string) | |
* $e_time = '7:00 pm' (string) | |
* $e_end = '11:00 pm' (string) | |
* $format_short = true (boolean) | |
*/ |
This file contains hidden or 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 new rule to match routes at "/events/page/#" | |
function add_rewrite_rules($aRules) { | |
$aNewRules = array('events/page/(\d+)/?$' => 'index.php?pagename=events&paged=$matches[1]'); | |
$aRules = $aNewRules + $aRules; | |
return $aRules; | |
} | |
// hook add_rewrite_rules function into rewrite_rules_array | |
add_filter('rewrite_rules_array', 'add_rewrite_rules'); |
This file contains hidden or 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/env ruby | |
require 'watir-webdriver' | |
@username = ENV["username"] | |
@password = ENV["password"] | |
@login_url = ENV["login_url"] | |
@product_url = "#{@login_url}/photos/" |
This file contains hidden or 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 truncate($string, $length, $tailing_char = '...') { | |
if (strlen($string) > $length): | |
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string . ' ', 0, $length)) . $tailing_char; | |
endif; | |
return $string; | |
} |
This file contains hidden or 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
// ========================================================================== // | |
// Media Query JS support | |
// ========================================================================== // | |
$(function(){ | |
mq_desktop = 620; | |
// Initial setup (all breakpoints) | |
$(document).ready(function() { | |
// Setup learnmore blocks | |
$('.learnmore').hide(); |