Skip to content

Instantly share code, notes, and snippets.

View estliberitas's full-sized avatar

Alexander Makarenko estliberitas

  • Hire me
  • Stockholm, Sweden
View GitHub Profile
@sindresorhus
sindresorhus / .profile
Created April 6, 2016 11:10 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
var LRU = require('lru-cache');
var i = 0;
var sets = 0;
var start = Date.now();
var last = Date.now();
var max = 8193; // 8192 is the magic number upper perf limit of plain objects
var maxAge = 1000 * 60 * 60 * 24;
@pmuellr
pmuellr / nsolid-install.sh
Last active January 31, 2021 13:19
sample script to install N|Solid components into ~/nsolid
#!/bin/bash
#-------------------------------------------------------------------------------
# download/unpack componentry for N|Solid into ~/nsolid
#-------------------------------------------------------------------------------
# updates:
# 2016-05-04 print note about officially supported "Download All" tarball
# 2016-02-10 change to get N|Solid versions dynamically from index.tab
# 2016-02-10 upgrade to N|Solid 1.2.1
# 2016-01-12 upgrade to N|Solid 1.2.0
@ericelliott
ericelliott / defaults-overrides.md
Last active May 7, 2023 13:52
ES6 defaults / overrides pattern

ES6 Defaults / Overrides Pattern

Combine default parameters and destructuring for a compact version of the defaults / overrides pattern.

function foo ({
    bar = 'no',
    baz = 'works!'
  } = {}) {
Benchmarking: create-10
bn.js#create-10 x 1,967,120 ops/sec ±1.65% (9 runs sampled)
bignum#create-10 x 642,220 ops/sec ±0.80% (8 runs sampled)
------------------------
Fastest is bn.js#create-10
========================
Benchmarking: create-hex
bn.js#create-hex x 2,610,191 ops/sec ±0.85% (9 runs sampled)
bignum#create-hex x 614,238 ops/sec ±2.36% (9 runs sampled)
------------------------
@chrisbuttery
chrisbuttery / index.js
Last active March 1, 2018 05:19
Control the flow of asynchronous calls with ES6 generator functions
/**
* get - XHR Request
*/
let get = function (url) {
return function (callback) {
let xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.onreadystatechange = function() {
let response = xhr.responseText;
@tonymtz
tonymtz / gist:714e73ccb79e21c4fc9c
Created November 15, 2014 00:02
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@halkeye
halkeye / sorted_json.rb
Created April 2, 2012 23:13
Puppet module for outputting json in a sorted consistent way
#
# sorted_json.rb
# Puppet module for outputting json in a sorted consistent way. I use it for creating config files with puppet
require 'json'
def sorted_json(json)
if (json.kind_of? String)
return json.to_json
elsif (json.kind_of? Array)