Skip to content

Instantly share code, notes, and snippets.

View ryan-roemer's full-sized avatar

Ryan Roemer ryan-roemer

View GitHub Profile
@ryan-roemer
ryan-roemer / bundle.multiple-exports.js
Last active March 4, 2021 05:44
Webpack: Various ways to have multiple exports.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@ryan-roemer
ryan-roemer / app.yaml
Created January 6, 2012 13:39 — forked from darktable/app.yaml
App.yaml designed for serving an authenticated, static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May n
# App configuration for static site with auth.
#
# Originally from: https://gist.github.com/873098
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
@ryan-roemer
ryan-roemer / index-esm.html
Last active August 30, 2019 19:03
Analytics vanilla HTML example using ESM
<!doctype html>
<html>
<head>
<title>Using Analytics in HTML</title>
</head>
<body>
<button id="track">
Track Click
</button>
@ryan-roemer
ryan-roemer / urql-publish-changes.diff
Last active February 15, 2019 22:13
urql - chore/publishing
$ publish-diff -o urql@1.0.0 -n .
Index: dist/types/client.test.d.ts
===================================================================
--- dist/types/client.test.d.ts urql@1.0.0
+++ dist/types/client.test.d.ts .
@@ -1,1 +1,0 @@
-export {};
\ No newline at end of file
Index: dist/types/context.test.d.ts
@ryan-roemer
ryan-roemer / urql-strict-vs-loose.diff
Created February 22, 2018 17:12
urql strict vs. loose mode diff
$ colordiff -Naurw lib-strict lib
diff -Naurw lib-strict/components/client.js lib/components/client.js
--- lib-strict/components/client.js 2018-02-22 09:09:37.000000000 -0800
+++ lib/components/client.js 2018-02-22 09:10:03.000000000 -0800
@@ -11,75 +11,30 @@
var _typenames = require("../modules/typenames");
-function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-
@ryan-roemer
ryan-roemer / compare.md
Last active September 22, 2017 20:49
Component Playground or React Live

Which live React component project should I use?

There are multiple options when it comes to live, editable React component environments. Formidable actually has two first class projects to help you out: component-playground and react-live. Let's briefly look at the libraries, use cases, and factors that might help in deciding which is right for you.

Here's a high-level decision tree:

  • If you want fast and easy setup and integration, then component-playground may be the ticket!
  • If you want a smaller bundle, SSR, and more flexibility, then react-live is for you!

Here are the various factors at play:

@ryan-roemer
ryan-roemer / 00-README.md
Created April 20, 2017 08:40
gzip math fun

GZ Math Fun

$ for f in *.js; do echo $f - $(gzip $f -c | wc -c); done
example.js - 178
without-0.js - 173
without-1.js - 172
without-01.js - 170
@ryan-roemer
ryan-roemer / prepare-commit-msg
Created December 31, 2012 19:57
Extract Pivotal Tracker story ID from git branch name and append to git commit messages.
#!/bin/sh
# Pivotal Tracker Ticket Extraction
# =================================
# Extract Pivotal Tracker ticket ID from branch name and prepend to commit
# message for GitHub hook.
#
# Takes a commit message like: "A commit comment" for branch "bug-1234-hello"
# and changes it to: "A commit comment [#1234]" for easier commit ticket
# updates.
@ryan-roemer
ryan-roemer / .gitignore
Last active September 21, 2016 19:38
Split files in directories into subfiles by line count. (So you can get viewable GitHub diff's for review-only code!)
\.git
\.hg
\.DS_Store
\.project
bower_components
node_modules
npm-debug\.log*
phantomjsdriver\.log
@ryan-roemer
ryan-roemer / bundle.js
Last active February 24, 2016 21:27
Simple JS file with lodash memoize.
// Here is the output bundle with filepaths included to see what _also_
// comes in with memoize.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache