Skip to content

Instantly share code, notes, and snippets.

View vladimir-vg's full-sized avatar
🙂

Vladimir Gordeev vladimir-vg

🙂
View GitHub Profile
@seriyps
seriyps / rf.erl
Last active February 1, 2018 15:43
Print erlang records as records, not tuples; print function source code
%% Prints source code of a function.
%%
%% Requires debug_info
%% Will not work for modules mocked by meck
%%
%% > io:format("~s~n", [rf:print_function(dict, new, 0)]).
%% new() ->
%% Empty = mk_seg(16),
%% #dict{empty = Empty, segs = {Empty}}.
@paulirish
paulirish / what-forces-layout.md
Last active May 9, 2024 07:00
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
@jaredmorrow
jaredmorrow / read_write_fifo_erlang.md
Last active April 22, 2023 20:05
Reading and Writing to Fifo (named pipes) in Erlang

edit

@akash-akya pointed out in the comments that the file module supports named pipes since OTP 20. So none of this post is really needed anymore if you are on >= OTP 21.


Erlang and Named Pipes

The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.

@essen
essen / http_specs.md
Last active January 10, 2022 02:01
HTTP and related specifications
@id
id / gist:cba5dbf7653d7eab6a03
Last active March 26, 2024 15:55
Tracing in erlang
F = fun(F, Fd) -> receive stop -> io:format(Fd, "stop~n", []), file:close(Fd), ok; Msg -> io:format(Fd, "~p~n", [Msg]), F(F, Fd) end end.
{ok, Fd} = file:open("/tmp/trace.out", [write]), Tracer = proc_lib:spawn(fun() -> F(F, Fd) end).
%% trace everything
erlang:trace(Pid, true, [all, {tracer, Tracer}]).
%% stop tracing
erlang:trace(Pid, false, [all, {tracer, Tracer}]).
Tracer ! stop.
%% match pattern
@jtomschroeder
jtomschroeder / ubuntuInstallEtoile.sh
Created August 7, 2012 20:10
Script for installing Etoile on Ubuntu
#!/bin/sh
# From http://svn.gna.org/viewcvs/*checkout*/etoile/trunk/Etoile/LiveCD/Subscripts/ubuntu-install-etoile.sh?content-type=text%2Fplain
# Date: Aug 7, 2012
# Initialize option variables with default values
BUILD_DIR=$PWD/build
PREFIX_DIR=/
ETOILE_VERSION=trunk
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@jeffrafter
jeffrafter / nginx.conf
Created September 20, 2011 15:58
Nginx proxy pass to localhost:3000 for development
worker_processes 1;
error_log /usr/local/var/log/nginx.error.log;
events {
worker_connections 1024;
}
http {
include mime.types;