Skip to content

Instantly share code, notes, and snippets.

View yashaka's full-sized avatar

Iakiv Kramarenko yashaka

View GitHub Profile
@LeZuse
LeZuse / 00_README.md
Last active June 25, 2024 04:07
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@OliverJAsh
OliverJAsh / foo.md
Last active September 4, 2023 15:31
`Option` vs non-`Option`

Option vs non-Option

Option<T> non-Option (T | undefined)
accessing property userOption.map(user => user.age) userNullish?.age
calling a method userOption.map(user => user.fn()) userNullish?.fn()
providing fallback ageOption.getOrElse(0) ageNullish ?? 0
filter ageOption.filter(checkIsOddNumber) `ageNull
@yashaka
yashaka / how-to-add-markdown-to-tilda-page-ru.md
Last active May 9, 2024 06:43
Как добавить markdown в tilda

Как добавить markdown в tilda

Базовой функционал

1 В head страницы добавляем:

<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script>
@gatopeich
gatopeich / dataclass_from_dict.py
Created February 19, 2019 15:08
Python 3.7 dataclass to/from dict/json
from dataclasses import dataclass, fields as datafields
from ujson import dumps, loads
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json
@dataclass
class Point:
x: float
y: float
# Shallow dataclass can be rebuilt from dict/json:
@monolithed
monolithed / mocha_vs_jasmine.md
Last active January 30, 2021 18:54
Mocha vs. Jasmine

Почему Mocha, а не Jasmine?

Ниже будут приведены аргументы в пользу выбора Mocha

  • Высокая популярность:
    — 4m против 400k загузок в месяц

  • Высокая активность:
    — 1 890 против 1400 коммитов (всего)
    — 171 против 101 коммитов (последний год)

@mikehearn
mikehearn / threadbox.kt
Created August 15, 2015 12:15
More advanced ThreadBox with affinity guards
// This is a class that attempts to stop you accessing variables outside a lock.
//
// It does not do a perfect job, but can catch some common kinds of mistake, in
// particular when you accidentally try to work with objects inside closures that
// end up running later, outside the locked region (or in a different thread).
// EXAMPLE
val bank = ThreadBox(object {
val accounts by arrayListOf(10, 0, 0, 0).guard()
@oderwat
oderwat / aporia-hacked-to-osx.md
Created March 22, 2015 01:07
Hacking Aporia (Nim IDE) to work on Yosemite OS X with GTK 2 Quartz (no X11)

Aporia on OS X Yosemite (GTK+ 2.x)

"Don't try at home or don't blame me for lost hours of your life!"

See this Nim Forum Topic where this started.

Well I have a working Aporia version on my Yosemite OS X 10.10.2 from the new-suggest branch of the repository.

BUT the lengths I had to go to get this working are plastered with stuff I did not understand :)

@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

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.

Vectors and Sequences

@plepe
plepe / __FILE__.js
Created October 15, 2012 11:13
__FILE__ in JavaScript
/***
* This gist provides a __FILE__ variable, which holds the path to the file
* from which the currently running source is being executed.
*
* Usage example: alert(__FILE__);
*
* Thanks to http://ejohn.org/blog/__file__-in-javascript/ on which this gist
* is based on.
*
* Tested in Mozilla Firefox 9, Mozilla Firefox 16, Opera 12, Chromium 18
@briancavalier
briancavalier / promise-monad-proof.js
Created August 8, 2012 15:57
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value