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 api.clj
(ns cloud-billing.api
(:require [cheshire.core :as json]
[clojure.java.io :refer [reader resource]]
[cloud-billing.config :as config]
[io.pedestal.http :as server]
[io.pedestal.http.route :as route]))
(defn parse-stream
A helper that turns a body-stream into a map by consuming it and parsing it as
json.
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 file_uploader.rb
class FileUploader < CarrierWave::Uploader::Base
require 'carrierwave/processing/mini_magick'
include CarrierWave::MiniMagick
storage :fog
version :thumb do
process :resize_first_page
process :convert => :jpg
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)
@haywoood
haywoood / om_todo.cljs
Created Dec 19, 2013
Om translation of simple react.js
View om_todo.cljs
(ns om-todos.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
;var Timer = React.createClass({
; getInitialState: function() {
; return {secondsElapsed: 0};
; },
; tick: function() {
; this.setState({secondsElapsed: this.state.secondsElapsed + 1});
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"}]})
View wont_work.cljs
(ns test.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [cljs.core.async :refer [<! chan put!]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(def app-state (atom {:projects
[{:id 1 :title "proj 1"}
{:id 2 :title "proj 2"}
{:id 3 :title "proj 3"}
View works!@#.cljs
(ns test.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [cljs.core.async :refer [<! chan put!]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(def app-state (atom {:projects
[{:id 1 :title "proj 1"}
{:id 2 :title "proj 2"}
{:id 3 :title "proj 3"}
View sigh.cljs
(ns test.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [cljs.core.async :refer [<! chan put! sliding-buffer]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(def app-state (atom {:default-project-id 5
:projects
[{:id 1 :title "proj 1"}
{:id 2 :title "proj 2"}
You can’t perform that action at this time.