Skip to content

Instantly share code, notes, and snippets.

View joelhooks's full-sized avatar
🍄

Joel Hooks joelhooks

🍄
View GitHub Profile
@acdlite
acdlite / flux.js
Last active October 7, 2021 17:19
A Redux-like Flux implementation in <75 lines of code
/**
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
*/
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@spoike
spoike / reactjs_componentapi_cheatsheet.md
Created May 13, 2014 07:51
React JS Cheatsheets for Component API, Specifications and Lifecycle

ReactJS Component Cheatsheet

To create a ReactComponent:

ReactComponent React.createClass(object proto)

Basic JSX example:

var TitleComponent = React.createClass({

// REQUIRED

@cobyism
cobyism / design-workflow-q-a.md
Last active February 23, 2017 07:48
Q&A on design workflows.

Design workflow Q&A

James Kirkpatrick sent me some questions about designing in the browser, and design workflows in general to help with his dissertation at the University of Ulster. Here are my responses.

Question: Do you feel that designing in browser is fast becoming the standard in web design, or do you feel that there will still be a few die-hard designers that will refuse to adopt the idea?

I think it is definitely on its way to becoming the standard, especially with the improvements in the pipeline in terms of what’s possible within developer tools (source-map support for Sass, CoffeeScript and so forth). It’s not catching on as quickly as I feel it should be though (given the benefits I feel it has), and honestly I feel like that’s simply because it’s hard for people to drop the tools they know and love cold-turkey. It can take a while to adjust to new tools and workflows, and to be able to afford the time in-between where you just have to accept that you won’t be as productive as usual is

@mattclar
mattclar / simple_form.rb
Last active December 21, 2015 13:58 — forked from tommarshall/simple_form.rb
this is a simple form initializer that is ALMOST compatible with Bootstrap3 apart from a way to set the class of the label this would work perfectly
# http://stackoverflow.com/questions/14972253/simpleform-default-input-class
# https://github.com/plataformatec/simple_form/issues/316
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
@tallship
tallship / install_tmux_centos6.sh
Created March 8, 2013 20:00
Install tmux on CentOS 6 this is a quick script for Installing the latest [libevent and] tmux on CentOS 6.3 Before anything, do a "yum update" It will install deps, download the latest sources (a/o 20130308), then compile and install everything. Deps: gcc kernel-devel make ncurses-devel (We're installing the latest libevent by hand). Next, we d/…
#!/bin/sh
# install_tmux_centos6.sh
# Make sure we have the deps
yum -y install gcc kernel-devel make ncurses-devel
# Get libevent and tmux source, and put it all under /usr/local/src
# and then untar it all, and config/compile/install them.
mkdir -p /usr/local/src/libevent
mkdir -p /usr/local/src/tmux
@olasitarska
olasitarska / pgessays.py
Created November 18, 2012 10:11
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html)
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@scottjehl
scottjehl / hideaddrbar.js
Created August 31, 2011 11:42
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){