Skip to content

Instantly share code, notes, and snippets.

@joshdover
joshdover / ExtendedRichUtils.js
Last active July 30, 2021 12:58
Example of how to add metadata to blocks for handling text alignment correctly
import { Modifier, EditorState, RichUtils } from 'draft-js';
import getCurrentlySelectedBlock from './getCurrentlySelectedBlock';
export const ALIGNMENTS = {
CENTER: 'center',
JUSTIFY: 'justify',
LEFT: 'left',
RIGHT: 'right'
};
@developit
developit / Rollup Automatic External Dependencies.md
Last active June 29, 2021 15:33
Rollup Automatic External Dependencies

Hi!

This is an example of how to use [Rollup] with external dependencies, without hard-coding them.

It reads your installed NPM dependencies and treats them as external to Rollup. They still get bundled, but not as ES2015.

Make sure you have a .babelrc or a "babel":{} section in your package.json.

package main
import (
"fmt"
"math"
"runtime"
"strings"
)
const (
@cameron
cameron / journalctl
Last active August 29, 2015 14:06
CoreOS bug: docker.service inactive/dead on boot in vagrant/vmware
-- Logs begin at Wed 2014-09-17 01:30:44 UTC, end at Wed 2014-09-17 01:40:14 UTC. --
Sep 17 01:30:44 localhost systemd-journal[87]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Sep 17 01:30:44 localhost systemd-journal[87]: Runtime journal is using 6.2M (max allowed 49.9M, trying to leave 74.8M free of 492.8M available → current limit 49.9M).
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpuset
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpu
Sep 17 01:30:44 localhost kernel: Initializing cgroup subsys cpuacct
Sep 17 01:30:44 localhost kernel: Linux version 3.15.8+ (buildbot@ip-10-204-3-57) (gcc version 4.6.3 (Gentoo Hardened 4.6.3 p1.13, pie-0.5.2) ) #2 SMP Fri Aug 15 22:29:31 UTC 2014
Sep 17 01:30:44 localhost kernel: Command line: init=/usr/lib/systemd/systemd console=ttyS0,115200n8 console=tty0 ro noswap cros_legacy root=LABEL=ROOT rootflags=subvol=root usr=gptprio: usr=PARTUUID=7130c94a-213a-4e5a-8
@jcouyang
jcouyang / why-curry-helps.md
Last active February 20, 2023 21:09
为什么要柯里化(why-curry-helps)slide http://git.io/why-curry-helps 📈

还记得 Haskell Curry吗,

多巧啊, 人家姓 Curry 名 Haskell, 难怪 Haskell 语言会自动柯里化, 呵呵. 但是不奇怪吗, 为什么要柯里化呢. 为什么如此重要导致 Haskell 会默认自动柯里化所有函数, 不就是返回一个部分配置好的函数吗.

我们来看一个 Haskell 的代码.

max 3 4
(max 3) 4
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active August 2, 2024 08:26
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

<?xml version="1.0" encoding="utf-8"?>
<dns>
<retcode>0</retcode>
<domainlist>
<domain name="extshort.weixin.qq.com" timeout="1800">
<ip>101.226.76.175</ip>
<ip>101.227.131.102</ip>
</domain>
<domain name="long.weixin.qq.com" timeout="1800">
@niclashoyer
niclashoyer / hipache-docker
Last active December 28, 2015 06:19
Shell script to start a docker container and add it to hipache
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) <year> <copyright holders>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@keeb-zz
keeb-zz / README.md
Created July 23, 2013 19:35
The power of Docker+Hipache - Immediate Test Environments, even with Static Port Forwarding

I do most of my development on a remote server or on a local virtual instance. It just makes more sense, being able to work in a portable environment and pick up where I leave off lets me worry less about environment and more about the problem at hand.

One of the problems with using a technology like VirtualBox in combination with Docker is that Docker containers are truly portable and should expose a random port chosen by the host while VirtualBox port forwarding is static. You could, for every container, create a new port forwarding rule in your VirtualBox configuration, but that requires you change host configuration to be able to run your application. Not ideal and certainly not portable.

Enter hipache. Hipache is the best way to configure reverse proxies. In this example, hipache is the entrypoint for all web traffic on the host. Running hipache in a container just like any other service allows for ultimate flexibility.

Vagrantfile

Vagrant is a cool way of abstracting VM semantics and spin

@machty
machty / router-facelift-guide.md
Last active July 10, 2024 15:14
Guide to the Router Facelift

Ember Router Async Facelift

The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.