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 Curry do | |
defmacro curry([{name, arity}]) do | |
(arity - 1) | |
|> Range.new(0) | |
|> Enum.map(fn arity -> | |
arguments = | |
Range.new(0, arity) | |
|> Enum.filter(&(&1 > 0)) | |
|> Enum.map(&"a#{&1}") | |
|> Enum.map(&String.to_atom/1) |
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
events = 1..5 | |
defmodule SyncOrAsync do | |
use GenStage | |
def start_link(mode) when mode == :async or mode == :sync do | |
GenStage.start_link(__MODULE__, mode, name: __MODULE__) | |
end | |
# GenStage API |
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
elm-stuff/ |
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
01234567-89ab-cdef-0123-456789abcdef |
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
module Child1 exposing (Msg(..), Model, init, update) | |
import WebData exposing (..) | |
type Msg | |
= Response (WebData (List String)) | |
type alias Model = |
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
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
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
setState(...args) { | |
/* eslint-disable no-console */ | |
console.trace(); | |
console.group(this.constructor.name); | |
console.log("props", this.props); | |
console.log("state", this.state); | |
console.log("nextState", args[0]); | |
console.groupEnd(this.constructor.name); | |
/* eslint-enable no-console */ | |
return Component.prototype.setState.apply(this, args); |
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://dan.doezema.com/2012/04/recursively-sort-ruby-hash-by-key/ | |
class Hash | |
def sort_by_key(recursive = false, &block) | |
self.keys.sort(&block).reduce({}) do |seed, key| | |
seed[key] = self[key] | |
if recursive && seed[key].is_a?(Hash) | |
seed[key] = seed[key].sort_by_key(true, &block) | |
end | |
seed |
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 'webrick' | |
server = WEBrick::HTTPServer.new(Port: 8080) | |
server.mount_proc '/' do |req, res| | |
res.body = req.body | |
end | |
server.start |
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
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md | |
# http://www.rubydoc.info/github/Homebrew/homebrew/master/Formula | |
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! | |
class Dnstwist < Formula | |
desc "" | |
homepage "" | |
url "https://github.com/elceef/dnstwist/archive/v1.01.tar.gz" | |
version "1.01" | |
sha256 "6fae9f722ee711598fd23a93169a8539eaf2210410b75af22d9a4241d23da842" |