View mode-mysql.js
/* ***** 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.
View ordinal.php
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]);
}
View Set.js
module.exports = function(arr) {
var map = {};
this.contains = function(val) {
return map.hasOwnProperty(val);
};
this.add = function(val) {
map[val] = true;
};
View screenshot.js
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;
});
View driver.js
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) {
View color.js
/**
* 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
View Custom_hg.xml
<?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>
View Model.php
<?php
namespace Expressive;
class Model extends \Eloquent {
protected static $fields = [];
protected static $unguarded = true;
function __construct(array $attributes = []) {
if(static::$fields) {
View FileSystemLoader.js
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;
View filter_select_options.js
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);