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
/* ***** BEGIN LICENSE BLOCK ***** | |
* Distributed under the BSD license: | |
* | |
* Copyright (c) 2010, Ajax.org B.V. | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* * Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. |
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 ordinal($number) { | |
$ends = array('th','st','nd','rd','th','th','th','th','th','th'); | |
$mod100 = $number % 100; | |
return $number . ($mod100 >= 11 && $mod100 <= 13 ? 'th' : $ends[$number % 10]); | |
} |
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
module.exports = function(arr) { | |
var map = {}; | |
this.contains = function(val) { | |
return map.hasOwnProperty(val); | |
}; | |
this.add = function(val) { | |
map[val] = true; | |
}; |
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 webdriver = require('selenium-webdriver'); | |
var fs = require('fs'); | |
var driver = new webdriver.Builder().build(); | |
webdriver.WebDriver.prototype.saveScreenshot = function(filename) { | |
return driver.takeScreenshot().then(function(data) { | |
fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) { | |
if(err) throw err; | |
}); |
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 webdriver = require('selenium-webdriver'); | |
var fs = require('fs'); | |
var driver = new webdriver.Builder() | |
.withCapabilities(webdriver.Capabilities.phantomjs()) | |
.build(); | |
webdriver.WebDriver.prototype.saveScreenshot = function(filename) { | |
return driver.takeScreenshot().then(function(data) { | |
fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) { |
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
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param {number} r The red color value | |
* @param {number} g The green color value | |
* @param {number} b The blue color value | |
* @return {array} The HSL representation |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<framework xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemas/frameworkDescriptionVersion1.1.3.xsd" name="Custom_hg" invoke="/usr/bin/hg" alias="hg" | |
enabled="true" version="2"> | |
<help><![CDATA[Mercurial Distributed SCM]]></help> | |
<command> | |
<name>add</name> | |
<help>add the specified files on the next commit</help> | |
</command> | |
<command> | |
<name>addremove</name> |
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 | |
namespace Expressive; | |
class Model extends \Eloquent { | |
protected static $fields = []; | |
protected static $unguarded = true; | |
function __construct(array $attributes = []) { | |
if(static::$fields) { |
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 nunjucks = require('nunjucks'); | |
var gaze = require('gaze'); | |
var lib = require('nunjucks/src/lib'); | |
var fs = require('fs'); | |
var path = require('path'); | |
var _ = require('lodash'); | |
// Node <0.7.1 compatibility | |
var existsSync = fs.existsSync || path.existsSync; |
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
exports.bindSelectDataFilter = function(select1, select2, dataAttr, backFilter) { | |
var $select1 = $(select1); | |
var $select2 = $(select2); | |
var $options = $select2.find('option'); // we need to cache these outside of the DOM; unfortunately this will break <optgroups> | |
var changeFunc = function() { | |
var $oldOption = $select2.find('option:selected'); | |
var selectValue = $select1.val(); | |
if(selectValue && selectValue != '0') { | |
$select2.html($options.filter(function() { | |
var dataValue = $(this).data(dataAttr); |
OlderNewer