Skip to content

Instantly share code, notes, and snippets.

View sevastos's full-sized avatar

sevastos sevastos

View GitHub Profile

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
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
@adlai
adlai / coinswap.txt
Last active March 19, 2021 23:40
Adapting CoinSwap for a Fungibility Market
In the protocol all parties are assumed to have private communications channels.
Phase 0. Sets up the escrows and their timeout refunds.
Phase 1. Makes it so that if Bob gets paid there is no way for Alice to fail to get paid.
Phase 2. Just releases the escrows directly because everyone is happy that cheating isn't possible.
Alice Bob
=========================================================
0. Compute TX_0: A>2of2{A,B'} | Compute TX_1: B>2of2{B,A'} \
1. Send TX_0 TXID ------------> |

build

Clone and build Node for analysis:

$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
@thanpolas
thanpolas / Gruntfile.js
Last active December 18, 2015 02:58
Node Server + Grunt Watch Tasks + Livereload using one command: grunt
module.exports = function (grunt) {
grunt.initConfig({
watch: {
options: {
livereload: true
},
// triggering livereload when the .css file is updated
// (compared to triggering when sass completes)
// allows livereload to not do a full page refresh
styles: {
@ivanvanderbyl
ivanvanderbyl / post_view.hbs
Last active September 23, 2016 15:16
A simple Handlebars helper to do automatically updating dates. Requires moment.js
<time>{{timeAgoInWords post.publishedAt}}</time>
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"