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
if (cluster.isMaster) { | |
var cpus = os.cpus().length; | |
var worker; | |
/* start up the HTTP servers */ | |
process.env.HTTP_WORKER = "1"; | |
for (var i = 0; i < cpus; i++) { | |
worker = cluster.fork(); | |
worker.isHTTP = 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
if ($image_w < $image_h) | |
{ | |
//portrait | |
$height = $max_height; | |
$width = round( $height*($image_w/$image_h) ); | |
} | |
if($image_w => $image_h) | |
{ | |
//landscape | |
if($image_h < ($image_w/2)) |
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
Route::get('{any}', function($url){ | |
return Redirect::to(mb_substr($url, 0, -1), 301); | |
})->where('any', '(.*)\/$'); |
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
# Load dependencies. | |
pmodload 'helper' | |
CURRENT_BG='NONE' | |
SEGMENT_SEPARATOR='⮀' | |
# Begin a segment | |
# Takes two arguments, background and foreground. Both can be omitted, | |
# rendering default background/foreground. |
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
http://travisjeffery.com/b/2013/09/testing-javascript-projects-with-grunt-jasmine-jshint/ | |
https://github.com/gruntjs/grunt-contrib-jshint | |
https://github.com/bkeepers/lucid/blob/master/spec/javascripts/z_jshint_spec.js |
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
defaults write com.apple.LaunchServices LSHandlers -array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.sublimetext.3;}' |
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
<script> | |
(function switchToHTML5() { | |
// create an html5 doctype | |
var newDoctype = document.implementation.createDocumentType('html', '', ''); | |
if (document.doctype) { | |
document.doctype.parentNode.replaceChild(newDoctype, document.doctype); | |
} else { | |
var currentHtml = document.head.parentNode; | |
currentHtml.parentNode.insertBefore(newDoctype, currentHtml) |
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
app.config(function($provide) { | |
$provide.decorator('fooDirective', function($delegate) { | |
var directive = $delegate[0]; | |
if(directive.restrict.indexOf('E') >= 0) { | |
makeElement(toDashCase(name)) | |
} | |
function toDashCase(str) { | |
return (str.charAt(0) + string.slice(1).replace(/([A-Z])/g, "-$&")).toLowerCase() |
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(undefined){ | |
var oldDir = angular.module('app').directive; | |
angular.module('app').directive = function(name, dFactory) { | |
var dir = oldDir(name, dFactory); | |
if(dir.restrict.indexOf('E') >= 0) { | |
makeElement(toDashCase(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
/* | |
$stateProvider.state('admin', { | |
url: '/admin', | |
data:{ | |
title: 'Logout', | |
only: 'admin' | |
}, | |
templateUrl: URL.toPartial('logout') | |
}) |
OlderNewer