Skip to content

Instantly share code, notes, and snippets.

View mitranim's full-sized avatar

Nelo Mitranim mitranim

View GitHub Profile
@yury-egorenkov
yury-egorenkov / prax.md
Last active April 19, 2016 13:37
prax doc
|| Prax это о том, почему это будет удобно программисту.
|| Можно ехать и на дрезине, но на мерседесе лучше.

Prax является основой для создания высококачественных динамических веб приложений, код которых остается простым для понимания и внесения изменений с ростом количества и сложности функций. Одной из основных причин замедления скорости разработки, снижения качества кода, увеличения регрессий является сложность контекста, который необходимо загрузить в голову программисту, что бы работать над кодом приложения. Под контекстом мы понимаем взаимосвязанность компонентов системы, осознание влияния их внутренних состояний на поведение, запоминание их интерфейсов. Переключение контекста между различными частями проекта так же отнимает меняльную энергию и занимает продолжительное время. Все это создает incidental complexity, которая экспоненциально растет с развитием проекта. Нелинейно увеличивается количество взаимосвязей между модулями, общее состояние проекта (сумма всех состояний всех модулей) размаза

// Debug/Checked compilation
const DEBUG = true;
function conditional(condition) {
return target => condition ? target : Function.prototype;
}
@conditional(DEBUG)
function assert(condition, message = "assertion failed.") {
if (!condition) throw new Error(message);
@paulirish
paulirish / what-forces-layout.md
Last active July 22, 2024 06:32
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@jclaggett
jclaggett / deftype+.clj
Created March 10, 2014 13:32
:delegate option for deftype
(ns deftype+
"Augmented deftype sporting a new :delegate option.")
;; code to get the methods of interfaces and protocols
(defmulti get-methods
"Return a map of all method names to their arity."
class)
(defmethod get-methods clojure.lang.PersistentArrayMap
[protocol]
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@hsablonniere
hsablonniere / README.md
Created May 2, 2012 22:42
scrollIntoViewIfNeeded 4 everyone!!!

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.