Skip to content

Instantly share code, notes, and snippets.

View dpaez's full-sized avatar
🥃
Check out SHER: https://sher.app 🎙️

Diego dpaez

🥃
Check out SHER: https://sher.app 🎙️
View GitHub Profile
@radosny
radosny / LLNODE.md
Last active May 20, 2019 02:49
Node postmortem debugging (OSX)

Node postmortem debugging (OSX)

I assume that you have an access to ssh and node server process is up and running.

1. Taking core dump

To get core dump of running node process:

  • Take PID of that process:
    pgrep -lf node
@ohanhi
ohanhi / joy-of-composition.md
Last active May 6, 2024 05:21
The Joy of Composition - Why stateless rendering is pure bliss

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

The Joy of Composition

Why stateless rendering is pure bliss

React just got stateless components, meaning that they are in essence pure functions for rendering. Pure functions make it dead simple - even fun - to refactor your views

@tjanczuk
tjanczuk / xpub-xsub.js
Created August 24, 2015 23:59
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
@jsguy
jsguy / mithril.ie.polyfill.js
Last active June 11, 2021 05:06
Mithril IE8 polyfill
// IE polyfills needed by mithril for IE8 and below
// array.indexOf - https://gist.github.com/revolunet/1908355
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt /*, from*/)
{
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@mxriverlynn
mxriverlynn / 1.js
Last active April 15, 2020 14:27
Standard deviation, in JavaScript
var sum = values.reduce(function(sum, value){
return sum + value;
}, 0);
var avg = sum / data.length;
@jstuckey
jstuckey / Bash Prompt with Git and Emoji
Last active October 13, 2022 02:06
Bash Prompt with Git and Emoji - Add to ~/.bash_profile
git_branch='`git rev-parse --abbrev-ref HEAD 2> /dev/null | sed s/^/\ \|\ /`'
emojis=(🐶 🐺 🐱 🐭 🐹 🐰 🐸 🐯 🐨 🐻 🐷 🐮 🐵 🐼 🐧 🐍 🐢 🐙 🐠 🐳 🐬 🐥)
emoji='`echo ${emojis[$RANDOM % 22]}`'
PS1="\[\033[0;36m\]\T | \W$git_branch | $emoji > \[\e[0m\]"
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 13, 2024 11:18
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@bag-man
bag-man / cpu.js
Last active May 5, 2024 22:16
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores