module.exports = Joi.object({
a: Joi.string()
}).description("");
is a lot to write. It would be cool if it could look like
object({
{ | |
"name": "myProject", | |
"description": "A test project to get my dependencies running", | |
"version": "1.0.0", | |
"preferGlobal": "true", | |
"dependencies": { | |
"mocha" : "*" | |
} | |
} |
var phantom=require('phantom'); | |
phantom.create(function(ph) { | |
ph.createPage(function(page) { | |
page.set('onInitialized', function() { | |
console.log("We are now inside onInitialized"); | |
}); | |
page.set('onLoadStarted', function() { | |
console.log("We are now inside onLoadStarted"); |
define("MB_INCLUDE_BLOCK", 3000); | |
function mb_echo($str, $to_encoding, $from_encoding) { | |
$len = mb_strlen($str); | |
for($pos=0; $pos < $len;) { | |
$part = mb_strcut($str, $pos, min($len-$pos, MB_INCLUDE_BLOCK), $from_encoding); | |
$pos += strlen($part); | |
$converted = mb_convert_encoding($part, $to_encoding, $from_encoding); | |
echo $converted; |
var rl = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
function Point(x, y){ | |
this.x = x; | |
this.y = y; | |
} | |
#!/bin/bash | |
sudo killall coreaudiod | |
sudo kextunload /System/Library/Extensions/AppleHDA.kext | |
sudo kextload /System/Library/Extensions/AppleHDA.kext |
{ | |
"cmd": ["npm", "test"], | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${project_path:${folder:${file_path}}}", | |
"selector": "package.json" | |
} |
#!/bin/bash | |
docker-gc() { | |
docker rm `docker ps -a -q` | |
docker rmi `docker images -q -f="dangling=true"` | |
} |
module.exports = Joi.object({
a: Joi.string()
}).description("");
is a lot to write. It would be cool if it could look like
object({
Joi is nice but it can also be used unsufficiently. For example: If you want to make sure that didn't forget a restriction on every input it would be nice to lint the joi definition for a quality assurance.
require("joi-qa").sizeRestrictions().wellDocumented().noRegExp().hasExamples().verify({
...
});
# | |
# npm-i (https://gist.github.com/martinheidegger/5217df563c8e1edcacbd) | |
# Helper to make installing a package in node-js more comfortable. | |
# | |
npm-i() { | |
if [[ -z "$1" ]]; then | |
echo "Usage: npm-i <package> (var)" | |
else | |
npm install $1 --save | |
if [[ "$2" == "var" ]]; then |