Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ryan Haywood haywoood

🏠
Working from home
Block or report user

Report or block haywoood

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am haywoood on github.
  • I am haywood (https://keybase.io/haywood) on keybase.
  • I have a public key ASA-S0Tx2fD9jIxAWd-0iTypruSmbpB4sxLrNBvplfNBPgo

To claim this, I am signing this object:

View reusable-connect.js
export const reusableConnect = (_localMapStateToProps, _localActions, globalActions = DEFAULT_MAP) => Component => {
const localMapStateToProps = _localMapStateToProps || defaultMapStateToProps
const localActions = _localActions || {}
const _mapStateToProps = getInstanceState => (state, props) => {
const localState = getInstanceState(state)
const retVal = localMapStateToProps(localState, state, props)
if (typeof(retVal) === "function") {
return localMapStateToProps(getInstanceState)
} else {
View simple-example.js
// Translation of the clock example on http://reagent-project.github.io/
import {state, ui, render} from "essence"
const timerState = state({
value: new Date(),
color: "#f34"
})
setInterval(() => timerState.value = new Date(), 1000)
View my-issue.cljs
(ns om-issue.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]))
(def state {:numbers/selected nil
:numbers/list [{:id 1 :name "one"}
{:id 5 :name "five"}
{:id 8 :name "eight"}
{:id 9 :name "nine"}]})
@haywoood
haywoood / word-increment.coffee
Created May 3, 2015
Saving work done in coffee console
View word-increment.coffee
getRamda = ->
script = document.createElement('script')
script.type = 'text/javascript'
script.src = 'https://rawgit.com/ramda/ramda/master/dist/ramda.js'
document.head.appendChild(script)
letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
charToNumber = (char) ->
idx = R.indexOf char, letters
View react-message.coffee
TU = React.addons.TestUtils
# Component actions
toggleAction = (state) ->
val = state.get 'showSubhead'
newState = state.set 'showSubhead', not val
render newState
incrementCounter = (state) ->
val = state.get 'count'
@haywoood
haywoood / message.cljs
Created Jan 15, 2015
message react component translated to clojurescript
View message.cljs
(ns brazil.core)
(def TU (.. js/React -addons -TestUtils))
(def d js/React.DOM)
(defn toggle-action [state]
(let [val (not (:show-subhead state))
new-state (assoc state :show-subhead val)]
(render new-state)))
@haywoood
haywoood / message.coffee
Last active Aug 29, 2015
React tutorial
View message.coffee
TU = React.addons.TestUtils
{ div
h1
h3
button } = React.DOM
# Component actions
toggleAction = (state) ->
val = state.get 'showSubhead'
View gist:ca576a75e5da555f5047
in paris, japanese-american
shirts are tied-together by
the sounds of congratulations
in paris, tunics is currency
the tunics are held together by volunteers
one volunteer is laughing with a child
while gender-identity-omitted buys a bike
with a pile of folded tunics.
the child is excited.
View yay.coffee
newMode = ([mode, type] = pair) ->
newProps = ramda.mixin { term: mode.term, eventCount: mode.count }, type
Em.Object.create newProps
You can’t perform that action at this time.