add this two functions to your .zshrc
e() {
gh copilot explain "$*"
}
s() {
gh copilot suggest "$*"
}
add this two functions to your .zshrc
e() {
gh copilot explain "$*"
}
s() {
gh copilot suggest "$*"
}
# the code is from https://www.youtube.com/watch?v=Y29SSOS4UOc | |
waiting = {} | |
topics.each do |topic| | |
Worker do | |
io = connect | |
io.write(topic) | |
while response = io.read_nonblock | |
if response == :wait_readable | |
waiting[io] = Worker.current |
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing
// SPDX-License-Identifier: MIT OR Apache-2.0 | |
pragma solidity 0.8.17; | |
import "hardhat/console.sol"; | |
contract AbiEncodePacked { | |
function run() public pure { | |
uint8[] memory uint8Array = new uint8[](3); | |
uint8Array[0] = 1; |
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.8.2 <0.9.0; | |
import "github/GNSPS/solidity-bytes-utils/contracts/BytesLib.sol"; | |
contract StingBytesUint { | |
// input: 0x6176616c616e636865 | |
// return: true |
It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media
This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.
#!/bin/bash | |
SR_PHRASE="..." # Mnemonic Phrase | |
SR_PUB_KEY="..." | |
curl -H "Content-Type: application/json" \ | |
--data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "'"${SR_PHRASE}"'", "'"${SR_PUB_KEY}"'"],"id":1 }' \ | |
"http://127.0.0.1:9933" |
#!/bin/bash | |
# rev4 - changes suggested by KownBash https://www.reddit.com/r/bash/comments/5cxfqw/i_wrote_a_simple_video_to_gif_bash_script_thought/da19gjz/ | |
# Usage function, displays valid arguments | |
usage() { echo "Usage: $0 [-f <fps, defaults to 15>] [-w <width, defaults to 480] inputfile" 1>&2; exit 1; } | |
# Default variables | |
fps=15 | |
width=480 |