Skip to content

Instantly share code, notes, and snippets.

View joeybeninghove's full-sized avatar

Joey Beninghove joeybeninghove

View GitHub Profile
@joeybeninghove
joeybeninghove / application.js
Created February 9, 2018 03:55
app/javascript/packs/application.js
import Rails from "rails-ujs"
Rails.start()
import * as ActiveStorage from "activestorage"
ActiveStorage.start()
import Turbolinks from "turbolinks"
Turbolinks.start()
import { Application } from "stimulus"
Hey Joey,
I’ve been looking into this a while and I’ve run into some blockers so it’s only half of a solution for now.
Here’s what you can do:
You need the IP that every container will see your computer as (what’s traditional 127.0.0.1). See IP of HOST available within site container? for instructions on how to get that. It’s as simple as running one command in Terminal.
Open Local and right-click on the site you want to connect to your Rails app
Click “Open Site SSH”
Enter nano /etc/hosts
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
@joeybeninghove
joeybeninghove / application.js
Created January 9, 2018 00:03
Rails 5.2 Webpacker Defaults
import Rails from "rails-ujs"
import Turbolinks from "rails-ujs"
import * as ActiveStorage from "activestorage"
Turbolinks.start()
ActiveStorage.start()
import '../src/application.css';
@joeybeninghove
joeybeninghove / notifier.rb
Created September 13, 2017 20:49
Tiny Pub/Sub in Ruby
class Notifier
attr_reader :events
def initialize
@events = {}
end
def subscribe(event, &handler)
@events[event] ||= []
@events[event] << handler

Option

The overarching entity for a particular option with its configuration and choices

Attributes

  • Label = What is shown on the form beside the input (Color, Size, etc.)
  • Input Type = Select Box, Checkbox, Radio Button
  • Instruction = Optional special instructions to show as the first list item if Select Box is the input type
  • Choices = List of Choice entities that each have their own configuration

Choice

@joeybeninghove
joeybeninghove / form.html
Created May 17, 2017 21:41
product form markup
<div class="cart66 naked">
<div class="cart66-form">
<form accept-charset="UTF-8" action="/products/forms/add_to_cart" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓">
<input name="authenticity_token" type="hidden" value="bMfr5cCyJKcxgSDdajlDe9NU7BlHeXScxhoGl3sRPPw=">
</div>
<input id="product_id" name="product_id" type="hidden" value="591a0c2d02aaaa20b0000059">
<input id="display" name="display" type="hidden" value="naked">
<input id="show_quantity" name="show_quantity" type="hidden" value="true">
# setting up and running a slurp
slurper = Slurpeee::Slurper.new
slurper.on(:progress) { |data| do_something_with(data) }
slurper.on(:some_other_known_event) { |data| do_something_with(data) }
slurp = slurper.slurp(url_to_slurp)
# slurper.rb
module Slurpeee
class Slurper
def initialize
@joeybeninghove
joeybeninghove / .bashrc
Created February 2, 2017 02:50
Red bash prompt
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
@joeybeninghove
joeybeninghove / wp-cli.sh
Created December 20, 2016 18:28
WP-CLI usage during WordPress and Pow Configuration
# WordPress and Pow: https://soderlind.no/wordpress-and-pow/
wp core download
wp core config --dbuser=admin --dbuser=root
wp core install --url=wp.dev --title=WordPress --admin_user=admin --admin_email=john@doe.com