Skip to content

Instantly share code, notes, and snippets.

View dwhite96's full-sized avatar

David White dwhite96

View GitHub Profile
@dwhite96
dwhite96 / _cart.html.erb
Last active December 12, 2019 04:00
aBox shopping cart feature
<%= link_to "My cart: #{current_order.quantity} items",
current_order_path,
id: "cart", class: "link item"
%>
@dwhite96
dwhite96 / matrix_bm.rb
Created August 23, 2019 01:05
Matrix Benchmarking
require 'benchmark'
class Matrix1
attr_reader :rows
def initialize(matrix_string)
@rows = convert(matrix_string)
end
def columns
@dwhite96
dwhite96 / Chat.jsx
Last active January 1, 2018 20:30
The code in this gist is for the Grow and Swap trade offer functionality including model, controller, views, and RSpec tests. Also included is code for the React.js chat component on the trade offer show page. This chat component uses PubNub for chat messaging services.
import PropTypes from 'prop-types'
import React from 'react'
import TextareaAutosize from 'react-textarea-autosize'
import PubNub from 'pubnub'
import './chat.scss'
export default class Chat extends React.Component {
static propTypes = {
channel: PropTypes.string.isRequired,