Skip to content

Instantly share code, notes, and snippets.

View developit's full-sized avatar
🦊
write, the codes

Jason Miller developit

🦊
write, the codes
View GitHub Profile
@zouhir
zouhir / index.js
Last active October 23, 2017 04:01
// add this please
// add this please
require("preact-cli/lib/lib/webpack/polyfills");
// look above
import { h } from "preact";
import habitat from "preact-habitat";
import Widget from "./components/hello-world";
@fstanis
fstanis / index.html
Last active March 16, 2020 03:15
Webpack HTML entry
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
dialog {
position: fixed;
top: 50%;
left: 50%;
right: auto;
padding: 30px;
transform: perspective(500px) translate(-50%, -50%);
background: linear-gradient(to bottom, #FFF, #F4F4F4) #FFF;
border: none;
border-radius: 3px;
{
"window.zoomLevel": 0,
"editor.fontFamily": "'Source Code Pro', Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 12,
"editor.insertSpaces": false,
"editor.minimap.enabled": false,
"editor.quickSuggestionsDelay": 100,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": false,
"editor.suggestFontSize": 11,
@slightlyoff
slightlyoff / push_payloads_userland.md
Last active September 30, 2022 23:11
Delivering H/2 Push Payloads To Userland

Background

One of the biggest missed opportunities thus far with HTTP/2 ("H/2") is that we are not yet able to sunset WebSockets in favor of H/2. Web Sockets and H/2 both support multiplexing messages bi-directionally and can send both textual and binary data.

Server Sent Events ("SSE"), by contrast, are not bi-directional (they're a "server-push-only" channel) and binary data cannot be sent easily. They are, however, very simple to implement. Adding to the menagerie of options, RTCPeerConnection can also be used to signal data to applications in a low-latency (but potentially lossy) way.

Because H/2 [does not support the handshake (upgrade) that WebSockets use to negotiate a connection](https://daniel.haxx.se/blog/2016/06/15/no-websockets-

@fokusferit
fokusferit / browserMocks.js
Last active May 14, 2018 15:11
Add Testing Strategy to preact-cli
// Mocks localStorage
const localStorageMock = (function() {
let store = {};
return {
getItem: (key) => store[key] || null,
setItem: (key, value) => store[key] = value.toString(),
clear: () => store = {}
};
@developit
developit / .gitignore
Last active March 31, 2019 18:19
git clone https://gist.github.com/b3db0d9bd810626bf3acf7329f3bcccd.git foo && cd foo && npm i && npm start
node_modules
npm-debug.log
dist
build
@tombigel
tombigel / README.md
Last active July 17, 2025 02:44 — forked from a2ikm/limit.maxfiles.plist
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run:

@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@developit
developit / prepublish.js
Created August 21, 2017 17:11
strip all non-essential fields from package.json prior to publishing.
var path = require('path').join(__dirname, '..', 'package.json');
var pkg = require(path);
['babel', 'greenkeeper', 'bundlesize', 'devDependencies', 'eslintConfig'].forEach(function(key) { delete pkg[key] });
pkg.scripts = { postinstall: pkg.scripts.postinstall, donate: pkg.scripts.donate };
require('fs').writeFileSync(path, JSON.stringify(pkg, null, 2));