Require this project in your composer.json file
"sensiolabs/security-checker": "2.x"
Add the following line to app/start/artisan.php:
var str = "[ 70W [ 50H [ 50W + 50W ] + 25H + 25H ] + 30W ]"; | |
str = str.replace(/([\d]+)(W|H)/g, function(match, t1, t2) { | |
var attr = (t2 === 'H') ? 'height' : 'width'; | |
return '<div ' + attr + "='" + t1 + "%'>"; | |
}).replace(/(]|\+)/g, '</div>').replace(/(\[)/g, ''); | |
console.log(str); |
public class Person implements Serializable { | |
private final String firstName; | |
private final String lastName; | |
public Person(String firstName, String lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
public String getFirstName() { |
// TODO: Add Validations | |
var List = function (value) { | |
this.value = value || []; | |
}; | |
List.prototype.unit = function (value) { | |
return new List(value); | |
}; | |
List.prototype.flatMap = function (fn, context) { |
var withWalking = function() { | |
this.walk = function() { | |
console.log(this.name + ' is walking'); | |
}; | |
this.turn = function(direction) { console.log('turning', direction); | |
}; | |
this.stopWalking = function() { | |
console.log('stopped walking'); | |
}; | |
}; |
angular | |
.module('MyApp') | |
.config(['$provide', function($provide){ | |
$provide.decorator('$rootScope', ['$delegate', function($delegate){ | |
Object.defineProperty($delegate.constructor.prototype, '$onRootScope', { | |
value: function(name, listener){ | |
var unsubscribe = $delegate.$on(name, listener); | |
this.$on('$destroy', unsubscribe); | |
}, |
#!/bin/bash | |
for man in 1 3 5 7; do | |
ln -sf /usr/local/lib/node_modules/npm/man/man${man}/* /usr/local/share/man/man${man} | |
done | |
ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm | |
npm update npm -g |
def findAdjWithBase(w: Int, h: Int)(r: Int, c: Int) = { | |
def check(x: (Int, Int)) = 0 < x._1 && x._1 <= h && 0 < x._2 && x._2 <= w | |
if(check((r, c))){ | |
List((-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)) | |
.map(x => (x._1 + r, x._2 + c)).filter(check) | |
} | |
} | |
val findAdj = findAdjWithBase(9, 9)_ |
define(['rivets', 'backbone'], function(rivets, Backbone){ | |
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
if (obj instanceof Backbone.Collection) { | |
obj.on('add remove reset', function () { | |
callback(obj[keypath]); | |
}); | |
} else { | |
obj.on('change:' + keypath, function (m, v) { |
#!/bin/bash | |
cp -f ~/.Trash/Sublime\ Text\ 2.app/Contents/Resources/Sublime\ Text\ 2.icns /Applications/Sublime\ Text\ 2.app/Contents/Resources/Sublime\ Text\ 2.icns |