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.
defmodule Httpoison.GitHub do | |
use HTTPoison.Base | |
def process_url(url) do | |
"https://api.github.com" <> url | |
end | |
def process_request_headers(headers) do | |
Dict.put headers, :"User-Agent", "github-httpoison" | |
end |
FROM hexlet/hexlet-base | |
RUN apt-install python-pip python-dev | |
RUN apt-install python3-pip python3-dev | |
RUN pip3 install pytest | |
ENV PYTHONDONTWRITEBYTECODE 1 |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.
However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on
require 'openssl' | |
require 'base64' | |
# ===== \/ sign ===== | |
# generate keys | |
key = OpenSSL::PKey::EC.new("secp256k1") | |
key.generate_key | |
public_key = key.public_key | |
public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format |
#%RAML 0.8 | |
title: World Music API | |
baseUri: http://example.api.com/{version} | |
version: v1 | |
schemas: | |
- halLink: | | |
{ "$schema": "http://json-schema.org/schema", | |
"type": "object", | |
"description": "a Hypertext Application Language link", |
;; ; made this macro scraching my head between the simplicity of Haskell for fix | |
;; ; and the absence of curryfication in Clojure. | |
;; (P expr-fn) ; makes expr-fn lazy | |
;; (P P expr-fn) ; curry one time expr-fn | |
;; (P P P expr-fn) ; curry two time expr-fn | |
;; (= ((((P P P str) "a") "b") "c") "abc") ;=> true | |
(defmacro P [& f] | |
(let [x (gensym 'x)] ;; cannot be replaced by x# due to nested macro expansion. |
1. | |
LOGIN_PAGE=http://localhost/users/sign_in | |
curl --cookie-jar cookie_file $LOGIN_PAGE | grep csrf-token | |
2. | |
<meta content="csrf-token" name="csrf-token" /> | |
#!/usr/bin/env ruby | |
# A sneaky wrapper around Rubocop that allows you to run it only against | |
# the recent changes, as opposed to the whole project. It lets you | |
# enforce the style guide for new/modified code only, as opposed to | |
# having to restyle everything or adding cops incrementally. It relies | |
# on git to figure out which files to check. | |
# | |
# Here are some options you can pass in addition to the ones in rubocop: | |
# |