Skip to content

Instantly share code, notes, and snippets.

View ericclemmons's full-sized avatar
🏠
Working from home

Eric Clemmons ericclemmons

🏠
Working from home
View GitHub Profile
@ericclemmons
ericclemmons / machine.js
Last active March 13, 2020 01:47
Generated by XState Viz: https://xstate.js.org/viz
// This state machine is trying to figure out how to allow a user to call `await Auth.getUser()` multiple times throughout their app and get the current user once it resolves.
// Utility to resolve a Promise externally
const defer = () => {
let res,rej;
const promise = new Promise((resolve, reject) => {
res = resolve;
rej = reject;
@ericclemmons
ericclemmons / README.md
Created April 15, 2018 23:36
Hot take on Zach Silveira's Gutenblock Demo!
@ericclemmons
ericclemmons / SortSelect.jquery.js
Created February 15, 2010 21:56
Sort a SELECT box's OPTIONs alphabetically
var SortSelect = function(select) {
var options = jQuery.makeArray(select.find('option'));
var sorted = options.sort(function(a, b) {
return (jQuery(a).text() > jQuery(b).text()) ? 1 : -1;
});
select.append(jQuery(sorted))
.attr('selectedIndex', 0);
};
@ericclemmons
ericclemmons / webpack.config.js
Created November 22, 2016 02:55
Minimal webpack + babel + Node v6 + Chrome
var webpack = require("webpack");
module.exports = {
module: {
loaders: [
{
exclude: /node_modules/,
loader: "babel-loader",
query: {
cacheDirectory: true,
@ericclemmons
ericclemmons / Dockerfile
Created September 2, 2014 15:57
evolution/wordpress-example Dockerfile
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /root
RUN apt-get -qq -y update
RUN apt-get -qq -y install software-properties-common
RUN apt-add-repository -y ppa:ansible/ansible
RUN apt-get -qq -y update
RUN apt-get -qq -y install ansible
@ericclemmons
ericclemmons / snazzy.itermcolors
Created September 17, 2016 03:18
Port of hyperterm-snazzy to iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.15977835655212402</real>
export default {
...
resolve: {
root: [
path.join(process.cwd(), "lib"),
],
},
...
@ericclemmons
ericclemmons / schools.address.state.js
Created June 12, 2016 04:30
Term for: schools.address.state (Stores the state abbreviation for a school's location)
/**
* Term: schools.address.state
*
* Stores the state abbreviation for a school's location.
*/
module.exports = {
table: 'school', // Entity table in DB
// `?state=tx` is supported (or would throw) here
filter: function(qb, value) {
@ericclemmons
ericclemmons / mixins:field-mixin.js
Last active December 19, 2015 00:48
Browserify seems to not be able to reference the same module if there are different paths (because of subdirectories?) Previously: Difficulty with dynamic components in React. Form (works) -> Field (works) -> Text (fails with "Object [object Object] has no method 'value' ). Apparently the mixins don't get mixed
var FieldMixin = {
value: function() {
return 'default value';
}
};
cat ~/.profile
export PATH="/usr/local/php5/bin:/usr/local/bin:$PATH"
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
GIT_PS1_SHOWDIRTYSTATE="false"
GIT_PS1_SHOWUPSTREAM="false"