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) { |
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
var should_show = $.cookie('testNameSpace'); | |
// Allow A/B test override. | |
if ($('body.override').length > 0) should_show = 1; | |
// User is a yes OR no choice yet. | |
if (should_show == 1 || (should_show == null && Math.random() < 0.2)) { | |
//Set cookie to yes. | |
$.cookie('testNameSpace', 1, { path : '/' }); |
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 PageCachable { | |
private $memcache, | |
$memcacheOptions = [ | |
'enabled' => FALSE, | |
'host' => 'localhost', | |
'port' => '11211', | |
'lifetime' => 10800, |
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 my_module_special_form($form, &$form_state, $node = FALSE) { | |
$node_id = (is_object($node) && is_numeric($node->nid)) ? $node->nid : ''; | |
// Ajaxify. | |
if (module_exists('context') && _tableau_is_active_context(array('ajaxify_premium')) {) | |
$form['#prefix'] = '<div id="formwrapper">'; | |
$form['#suffix'] = '</div>'; | |
// Submit button. |
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
// Logging "constants" | |
nameSpace.watchLogDEBUG = 7; | |
nameSpace.watchLogNOTICE = 5; | |
nameSpace.watchLogWARNING = 4; | |
nameSpace.watchLogERROR = 3; | |
/** | |
* Log events. | |
* | |
* EXAMPLES: |
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
--- | |
name: Ms. Awesome | |
email: awesome@example.com | |
favSkills: | |
- api | |
- js | |
- php | |
intSkills: | |
- performance | |
- ci |
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
--- | |
name: Mr. Smarty | |
email: smarty@example.com | |
favSkills: | |
- crm | |
- drupal | |
- ux | |
intSkills: | |
- modules | |
- css |