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
# iex --sname b1 --cookie monster -S mix | |
# iex --sname b2 --cookie monster -S mix | |
# Node.connect(:"b1@localhost") | |
# http://www.brianstorti.com/getting-started-with-plug-elixir/ | |
defmodule HelloPlug.Worker do | |
use GenServer | |
def start_link do | |
Plug.Adapters.Cowboy.http(MyPipeline, %{}) |
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://programmers.stackexchange.com/questions/283989/what-makes-functional-programming-languages-declarative-as-opposed-to-imperative | |
``` | |
The basic unit of an imperative program is the statement. Statements are executed for their side effects. | |
They modify the state they receive. A sequence of statements is a sequence of commands, denoting do this then do that. | |
The programmer specifies the exact order to perform the computation. This is what people mean by telling the computer | |
how to do it. | |
The basic unit of a declarative program is the expression. Expressions do not have side effects. They specify | |
a relationship between an input and output, creating a new and separate output from their input, rather than |
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
{ | |
query: { | |
filter: {...} | |
} | |
aggs: { | |
impressions: {...}, | |
gender: { |
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
# SVG group | |
https://www.dashingd3js.com/svg-group-element-and-d3js | |
Guides | |
https://www.dashingd3js.com/table-of-contents |
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 Foo do | |
def map([], _func) do | |
[] | |
end | |
def map([head|tail], func) do | |
[func.(head) | map(tail, func)] | |
end |
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 isPlainObject = require('lodash.isplainobject'); | |
var reduce = require('lodash.reduce'); | |
function validate (source, validatorMapping, path) { | |
var _path = path || []; | |
if (!isPlainObject(source)) { throw new Error('@source must be a plain object') } | |
if (!isPlainObject(validatorMapping)) { throw new Error('@validatorMapping must be a plain object') } |
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
require 'sshkit' | |
require 'sshkit/dsl' | |
on 'brian@someserverip' do | |
within "/opt/somewhere" do | |
puts capture(:pwd) | |
end | |
end |
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 nodemailer = require('nodemailer') | |
var transport = nodemailer.createTransport('SMTP', { // [1] | |
service: "Gmail", | |
auth: { | |
user: "[email protected]", | |
pass: "userpass" | |
} | |
}) | |
if (process.env.NODE_ENV === 'production') { // [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
var express = require('express'); | |
var app = express(); | |
var server = app.listen(3005); | |
var id = 1; | |
app.get('/stream', function (req, res, next) { | |
var clearId = setInterval(function() { |
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
import request from 'request'; | |
import follow from 'follow'; | |
// follow("http://127.0.0.1:5984/anything", function(error, change) { | |
// if(!error) { | |
// console.log("Got change number " + change.seq + ": " + change.id); | |
// } | |
// }) | |
// request |