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 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 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 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 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 Set.js
module.exports = function(arr) { | |
var map = {}; | |
this.contains = function(val) { | |
return map.hasOwnProperty(val); | |
}; | |
this.add = function(val) { | |
map[val] = true; | |
}; |
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 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. |
NewerOlder