Skip to content

Instantly share code, notes, and snippets.

View blissdev's full-sized avatar

Jordan Arentsen blissdev

View GitHub Profile
@armon
armon / consul-tunes.md
Last active September 27, 2020 17:54
Running Consul as a global K/V store

Simplest way to do this with Consul is to run a single "global" datacenter.

This means the timing for the LAN gossip need to be tuned to be WAN appropriate. In consul/config.go (https://github.com/hashicorp/consul/blob/master/consul/config.go#L267) Do something like:

// Make the 'LAN' more forgiving for latency spikes
conf.SerfLANConfig.MemberlistConfig = memberlist.DefaultWANConfig()

Then we need to tune the Raft layer to be extremely forgiving.

@rauhs
rauhs / Makefile
Last active July 7, 2020 19:44
Compiling clojurescript + figwheel without boot nor leiningen. Using leiningen to manage dependencies. Print file size stats (raw, gzip, brotli) for production builds
CLJ_NREPL_PORT:=22340
FIGWHEEL_PORT:=22345
CLJS_JAR_VERSION:=1.7.48
CLJS_JAR_URL:=https://github.com/clojure/clojurescript/releases/download/r$(CLJS_JAR_VERSION)/cljs.jar
.PHONY: def_target
def_target : null
@mik01aj
mik01aj / README.md
Last active April 21, 2017 13:02
How to use Tether with React

Tether is a great library for positioning stuff (tooltips, modals, hints, etc) in your web app.

But, as I use React, it was pretty problematic for me, as Tether mutates the DOM and React breaks miserably when it sees mutated DOM. The solution is to have the tethered element outside the part of the DOM tree which is controlled by React (in this case, I use document.body).

That's why I created 2 helpers to use Tether with React.

The first one, TetheredElement is a plain JS helper to create a new element, attach it to some other one via Tether, and populate it with some React component.

The second one, TetherTarget is a React component and it uses TetheredElement to integrate it further with React, so that you can attach components to each other with Tether, without leaving the cozy React/JSX world and worrying about manual DOM operations. Just write:

@Jaza
Jaza / Private-pypi-howto
Last active July 2, 2023 16:24
Guide for how to create a (minimal) private PyPI repo, just using Apache with directory autoindex, and pip with an extra index URL.
*
// Have some complicated non-React widgets that manipulate DOM?
// Do they manage a list of DOM elements? Here's how to wrap it
// into a React component so you can "constantly rerender" it.
// A dumb non-react widget that manually manage some DOM node that
// represent a list of items
function NonReactWidget(node) {
this.node = node;
}
@cemerick
cemerick / user.clj
Last active August 29, 2015 14:21
user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; add to your user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL
; https://github.com/clojure/clojure/blob/master/changes.md#17-printing-as-data
(in-ns 'clojure.core)
; from 1242c48
(defn- print-object [o, ^Writer w]
(when (instance? clojure.lang.IMeta o)
(print-meta o w))
(.write w "#<")
@sgrove
sgrove / learn_gamma.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL Lesson 1" with "Learn Gamma Lesson 1"
;; Gamma (shader-generation): https://github.com/kovasb/gamma
;; Gamma Driver (WebGL resource management, aka "Om for WebGL"): https://github.com/kovasb/gamma-driver
;; Gamma examples: https://github.com/kovasb/gamma-examples
(ns gampg.learn-gamma.lesson-01
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
@timoxley
timoxley / gist:ae19556a33dd3867a697
Last active August 29, 2015 14:20
tl;dr. 2.5 Dynamic Behavior Changes: Changing An Instance’s Class and Dynamic Inheritance

Organizing Programs Without Classes

Source: https://cs.au.dk/~hosc/local/LaSC-4-3-pp223-242.pdf

Section 2.5 Dynamic Behavior Changes: Changing An Instance’s Class and Dynamic Inheritance

tl;dr

Sometimes the behavior of an instance of a data type can be divided into several different “modes” of behavior or implementation…

/*
* based on https://gist.github.com/sebmarkbage/fac0830dbb13ccbff596
* by Sebastian Markbåge
*/
import React from 'react';
const noop = () => {};
const es6ify = (mixin) => {
if (typeof mixin === 'function') {
@lewisd32
lewisd32 / iptableflip.sh
Created April 15, 2015 18:20
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866