Применить функцию к каждому элементу списка - это просто: ###GHC/Base.lhs
map _ [] = []
map f (x:xs) = f x : map f xs
class Jobs < ROM::Relation[:sql] | |
schema(:jobs) do | |
# ... | |
associations do | |
belongs_to :team | |
belongs_to :template | |
belongs_to :address | |
belongs_to :client | |
end |
A complete gdb to lldb command map.
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
list: | |
- name: Adobe Systems | |
name2: Adobe Systems Inc. | |
url: http://www.adobe.com | |
symbol: ADBE | |
price: 39.26 | |
change: 0.13 | |
ratio: 0.33 | |
- name: Advanced Micro Devices | |
name2: Advanced Micro Devices Inc. |
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 |
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
This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.
It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.
To see it in action, go to craigmod.com and press CMD-/
and start typing.
# typed: strict | |
# frozen_string_literal: true | |
require "base32" | |
require "securerandom" | |
require "ulid" | |
# A type to represent UUIDs. Particularly useful for annotating fields in API | |
# representations or Sorbet parameters to help prevent accidentally mixing up | |
# UUIDs and EIDs as they're being passed around as loose strings. |