Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
//Long Shadow | |
//http://codepen.io/awesomephant/pen/mAxHz | |
//Usage: @include long-shadow(box/text, #000, 200, false, false, left); | |
@mixin long-shadow($type, $color, $length, $fadeout: true, $skew: false, $direction: right){ | |
$shadow: ''; | |
@if $skew == false or $type == text{ | |
@if $direction == right { | |
@for $i from 0 to $length - 1 { | |
$shadow: $shadow + $i + 'px ' + $i + 'px 0 ' + $color + ','; |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
var mySingleton = (function(){ | |
var instance = null | |
function K(){ | |
if(!instance || this !== instance) throw "Constructor is a singleton" | |
return this | |
} | |
K.prototype.foo = function(){} |
var objectPool = []; | |
var marker = 0; | |
var poolSize = 0; | |
//any old JavaScript object | |
function commonObject () { } | |
commonObject.create = function () { | |
if (marker >= poolSize) { | |
commonObject.expandPool(poolSize * 2); |
Every time I start a new project, I want to pull in a log
function that allows the same functionality as the console.log
, including the full functionality of the Console API.
There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log
was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.
This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:
// as discussed by Crockford here: http://www.youtube.com/watch?v=dkZFtimgAcM | |
// more detailed example here: https://github.com/douglascrockford/monad/blob/master/monad.js | |
function MONAD() { | |
return function unit(value) { | |
var monad = Object.create(null); | |
monad.bind = function (func) { | |
return func(value); | |
}; | |
return monad; |
// remove key from object | |
_.mixin({ | |
remove: function(obj, key){ | |
delete obj[key]; | |
return obj; | |
} | |
}); |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: