Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
backend F_${backendname} { | |
.between_bytes_timeout = 10s; | |
.connect_timeout = 1s; | |
.dynamic = true; | |
.first_byte_timeout = 15s; | |
.host = "${hostname}"; | |
.max_connections = 200; | |
.port = "443"; | |
.share_key = "..."; | |
.ssl = true; |
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 cProfile | |
import contextlib | |
import io | |
import pstats | |
import sys | |
import timeit | |
@contextlib.contextmanager | |
def prof(*restrictions, stdout=True, dump=None, sortby='cumulative'): |
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
# https://minhajuddin.com/2016/03/03/put-this-in-your-code-to-debug-anything | |
require 'rouge' | |
require 'method_source' | |
require 'pp' | |
class Dbg | |
def initialize(object, to:) | |
@object, @stream = object, to | |
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
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
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
// It's important to realise that you'll only ever want to `go build` or `go run` a single file | |
// This confused me originally | |
// I could understand why my task's `Context` didn't get passed the name of the changed file | |
// The problem was I was just hacking little scripts together | |
// In practice, you'll be working within a project directory and you'll have a single entry point file | |
package main | |
import . "gopkg.in/godo.v1" |
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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
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
" run command | |
" no stdin | |
" output displayed in "Press enter to continue" style | |
" current buffer untouched | |
:!uptime | |
" run command | |
" pipe range of text to command on stdin | |
" output replaces the range in the current buffer | |
:RANGE!grep foo |
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.exports = curry; | |
function curry (f) { | |
var arity = f.length; | |
var params = []; | |
var end = createEnd(f, arity); | |
return createCurried(params, arity, end); | |
} | |
function createEnd (f, arity) { |
NewerOlder