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
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,
@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
@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));
@developit
developit / * Preact Compat "Lite".md
Last active September 22, 2022 15:44
a lot of libs can roll with this tiny shim.

Usage:

In your webpack config:

resolve: {
  alias: {
    'react': 'preact-compat-lite',
    'react-dom': 'preact-compat-lite'
 }

Preact for Angular 1 Users

Here's my quick attempt to build a tiny preact app using terminology from Angular 1.

Installation

# get it
git clone https://gist.github.com/e5de4c33c1a8d8fd172905010d3ff75c.git preact-for-angular1-users
cd preact-for-angular1-users
@developit
developit / static-app.json
Created May 22, 2017 20:43
preact-cli config output example
{
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**",
@developit
developit / demo.html
Last active May 12, 2017 14:31
Just bundle embed.js via webpack with target:umd and the name "embed" (or pick one)
<script src="/path/to/embed.umd.js"></script>
<div id="foo"></div>
<script>
var parent = document.getElementById('foo')
embed.renderWidget(
'foo', // widget name
{ a: 'b' }, // props
parent // render into this
);