Skip to content

Instantly share code, notes, and snippets.

@skt-t1-byungi
skt-t1-byungi / 코루틴.md
Last active Aug 24, 2022
코루틴설명
View 코루틴.md

제네레이터, 또는 async함수와 같은 코루틴은 로직을 일시중단(yield또는 await을 통해)할 수 있습니다. 기존의 콜백패턴에선 로직 상태를 구분 하기 위해 플래그 변수가 필요한데 코루틴 패턴에선 코드가 중단된 지점으로써 대신 표현가능합니다.

BEFORE:

const el = document.querySelector('.draggable')

let isTouching = false // <= 플래그변수, 로직이 복잡할 수록 늘어남
@wayou
wayou / .yarnrc
Last active Aug 24, 2022
配置 yarn 使用国内镜像进行安装的 rc 文件,将此文件放到项目根目录使用
View .yarnrc
registry "https://registry.npm.taobao.org"
disturl "https://npm.taobao.org/dist"
nvm_nodejs_org_mirror "http://npm.taobao.org/mirrors/node"
NODEJS_ORG_MIRROR "http://npm.taobao.org/mirrors/node"
sass_binary_site "http://npm.taobao.org/mirrors/node-sass"
electron_mirror "http://npm.taobao.org/mirrors/electron/"
SQLITE3_BINARY_SITE "http://npm.taobao.org/mirrors/sqlite3"
profiler_binary_host_mirror "http://npm.taobao.org/mirrors/node-inspector/"
node_inspector_cdnurl "https://npm.taobao.org/mirrors/node-inspector"
selenium_cdnurl "http://npm.taobao.org/mirrors/selenium"
@giuliano-oliveira
giuliano-oliveira / download_file.rs
Last active Aug 24, 2022
Download large files in rust with progress bar using reqwest, future_util and indicatif
View download_file.rs
// you need this in your cargo.toml
// reqwest = { version = "0.11.3", features = ["stream"] }
// futures-util = "0.3.14"
// indicatif = "0.15.0"
use std::cmp::min;
use std::fs::File;
use std::io::Write;
use reqwest::Client;
use indicatif::{ProgressBar, ProgressStyle};
View falsehood-prices.md

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@mihow
mihow / load_dotenv.sh
Last active Aug 24, 2022
Load environment variables from dotenv / .env file in Bash
View load_dotenv.sh
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@akshuvo
akshuvo / WordPress Repeater MetaBox.php
Last active Aug 24, 2022
Creating a “repeater meta-box” without a Plugin in WordPress
View WordPress Repeater MetaBox.php
<?php
add_action('admin_init', 'gpm_add_meta_boxes', 2);
function gpm_add_meta_boxes() {
add_meta_box( 'gpminvoice-group', 'Custom Repeatable', 'Repeatable_meta_box_display', 'page', 'normal', 'default');
}
function Repeatable_meta_box_display() {
global $post;
$gpminvoice_group = get_post_meta($post->ID, 'customdata_group', true);
View BestVTuberSoftware.md

Best VTuber software

This is a list of the most commonly used and relevant vtubing software. The "best" will always be subjective and depend on your specific requirements. Overall, the information in this list is as accurate as I could figure it out, but there might be errors or some details might become out of date. If you find anything that needs to be corrected, please let me know. You can also note it in a comment.

Additional explanations:

  • iPhone means that an iPhone is basically required
  • iFacialMocap support means that tracking data can be received from the iFacialMocap iPhone app
  • VMC protocol means that the application can send and/or receive tracking data from other VMC protocol capable applications, allowing the combination of multiple tracking methods (e.g. VSeeFace receiving VR tracking from Virtual Motion Capture and iPhone/ARKit face tracking from Waidayo)
  • Tobii means that the Tobii eye tracker is supported
@bradtraversy
bradtraversy / docker-help.md
Last active Aug 24, 2022
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@beached
beached / C++ normal operators.md
Last active Aug 24, 2022
A list of the normal signatures of C++ operators that allow overloading
View C++ normal operators.md

C++ Operator Signatures

This is a list of C++ operators that can be overloaded and their normal signatures(a.k.a what an int would do). The order is the preffered order to use them(The first one listed is often preffered)

Arithmetic

operator+ addition

  • free function -> T operator+( T const & lhs, T const & rhs )
  • member function -> T operator+( T const & rhs ) const

operator+ unary plus

  • member function -> T operator+( ) const
@nateraw
nateraw / stable_diffusion_walk.py
Created Aug 18, 2022
Walk between stable diffusion text prompts
View stable_diffusion_walk.py
"""
Built on top of this gist by @karpathy:
https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355
stable diffusion dreaming over text prompts
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stable_diffusion_walk.py --prompts "['blueberry spaghetti', 'strawberry spaghetti']" --seeds 243,523 --name berry_good_spaghetti