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
defmodule WithTest do | |
def run do | |
with{:ok, a} <- fun("A"), | |
{:ok, b} <- fun("B"), | |
{:ok, c} <- fun("C") | |
do | |
{:ok, [a,b,c] } | |
else | |
{:error, err} -> | |
{:error, err} |
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
var RSMQWorker = require( "./" ); | |
var RedisSMQ = require("rsmq"); | |
var WORKERCOUNT = 12; | |
var rsmq = new RedisSMQ( {host: "127.0.0.1", port: 6379, ns: "rsmq"} ); | |
rsmq.setMaxListeners(WORKERCOUNT) | |
// count the event listener per event | |
var countListener = function(){ | |
var _ret = {}; |
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
DEFAULT_IP=127.0.0.1 | |
IP=${2:-$DEFAULT_IP} | |
sed -ie "\| $1\$|d" /etc/hosts | |
echo "$IP $1" >> /etc/hosts | |
exit 0 |
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
#! /bin/sh | |
# @author: Claus Witt | |
# http://clauswitt.com/319.html | |
# Adding or Removing Items to hosts file | |
# Use -h flag for help | |
DEFAULT_IP=127.0.0.1 | |
IP=${3:-$DEFAULT_IP} |
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
nsqlookupd -http-address=127.0.0.1:4161 -tcp-address=127.0.0.1:4160 & | |
nsqlookupd -http-address=127.0.0.1:4163 -tcp-address=127.0.0.1:4162 & | |
nsqd -lookupd-tcp-address=127.0.0.1:4160 -lookupd-tcp-address=127.0.0.1:4162 & | |
nsqadmin -lookupd-http-address=127.0.0.1:4161 -lookupd-http-address=127.0.0.1:4163 & |
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
_data = | |
foo: 23 | |
bar: 42 | |
bazz: null | |
$.ajax | |
url: _path | |
type: "POST" | |
data: JSON.stringify( _data ) | |
contentType: "application/json; charset=utf-8" |
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
// Install: "npm i prompt" | |
// Usage: "node dh.js" | |
var crypto, dh, prompt; | |
crypto = require('crypto'); | |
prompt = require('prompt'); | |
dh = crypto.getDiffieHellman('modp5'); | |
dh.generateKeys(); |
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
### | |
USAGE: | |
1. Make sure you have a valid fontello config file | |
2. call "grunt edit-font" -> your browser will open with a session based on your config file | |
3. Edit your font within fontello and click "Save session" | |
4. call "grunt update-fonts". This will call the task "update-fonts-config" to download the session zip and replace the config. Then it's call the task `fontello:standard` based on your config.json. | |
### |
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
root = @ | |
MYMODULE = | |
foo: 42 | |
fizzy: -> | |
return "bubbele" | |
# Export the module | |
if typeof module isnt 'undefined' and module.exports | |
exports = module.exports = MYMODULE |
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
txt = [] | |
$( ".list" ).each ( idx, tbl )-> | |
txt.push "\n## " + $(tbl).find( "h2" ).text() + "\n" | |
$(tbl).find( ".js-card-name" ).each (idx, card)-> | |
txt.push "- " + card.lastChild.data | |
txt.join( "\n" ) |