Skip to content

Instantly share code, notes, and snippets.

Mitch VanDuyn catmando

Block or report user

Report or block catmando

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 hyper_store.rb
module HyperStore
def self.included(base)
base.extend ClassMethods
module ClassMethods
def state_reader(state_name)
define_method(state_name) { React::State.get_state(self, state_name) }
# render {}
View date_picker.rb
class DateTimePicker < React::Component::Base
param :record # typically an active_record model, but can be any object really
param :field # attr (read and write) of the object to be updated.
after_mount do
def initialize_timepicker
catmando / controller_op.rb
Last active Jun 22, 2017
hyper operation Controller Operation experimental patch
View controller_op.rb
# app/hyperloop/operations/controller_op.rb
# make sure to also require 'operations/controller_op'
# at the *END* of config/initializers/hyperloop.rb
module Hyperloop
# monkey patch HyperloopController to pass controller instance from controller method to ServerOp
Engine.routes.append do
View mapper.rb
class Something
def self.display_map
key: :position,
name: 'Number'
key: :design_collection,
name: 'Collection',
catmando / gist:096c29d0fb06873ad978
Last active Sep 27, 2017
Carrierwave Custom Version
View gist:096c29d0fb06873ad978
class CustomUploader < CarrierWave::Uploader::Base
# complete example of custom carrierwave version generator that does not use manipulate with hopefully helpful comments
# in this case we are uploading a .psd (photoshop file) and then rendering to a png. We want to
# save the original psd, so we create a png version.
storage :file
version :png do # tells carrierwave to generate a new version of the upload in this case a "png"
catmando / linked_list.rb
Created Oct 13, 2017
Translate this code please
View linked_list.rb
class Node
# each node has a val (value) and a link to the next node.
def val # reads the instance variable val
def next_node # reads the instance variable next_node
View todo-item-compare-react.jsx
import React, {Component} from 'react';
import './ToDoItem.css';
class ToDoItem extends Component {
render() {
return (
<div className="ToDoItem">
<p className="ToDoItem-Text">{this.props.item}</p>
<button className="ToDoItem-Delete"
View todo-item-compare-hyperstack.rb
class TodoItem < HyperComponent
param :item
fires :delete_item
render(DIV, class: 'ToDoItem') do
P(class: 'ToDoItem-Text') { @Item }
BUTTON(class: 'ToDoItem-Delete').on(:click) { delete_item! }
View todo-compare-react.jsx
import React, {Component} from 'react';
import './ToDo.css';
import ToDoItem from './components/ToDoItem';
import Logo from './assets/logo.png';
class ToDo extends Component {
constructor(props) {
this.state = {
// this is where the data goes
View todo-compare-hyperstack.rb
class TodoIndex < HyperComponent
# TodoIndex is the conventional name for listing
# a set of items.
todo: 'clean the house'
todo: 'buy milk'
You can’t perform that action at this time.