This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# :coffeescript | |
jQuery -> | |
designs = $('.design').html() | |
$('.style').change -> | |
style = $('.style option:selected').text() | |
options = $(designs).filter("optgroup[label='" + style + "']").html() | |
$('.design').html(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple_form Reform Form for creating a basic postal address | |
# errors will be shown on the violating fields | |
= simple_form_for(@form, remote: true) do |f| | |
.modal-dialog | |
.modal-content | |
.modal-header | |
%button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} × | |
%h3.modal-title | |
New Address for | |
= @customer.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#tabs | |
%ul.nav.nav-tabs.nav-justified | |
%li.active | |
= link_to 'Quotes', '#quotes', data: { toggle: "tab" } | |
%li | |
= link_to 'Draft', '#drafts', data: { toggle: "tab" } | |
%li | |
= link_to 'Submitted', '#submitted', data: { toggle: "tab" } | |
%li | |
= link_to 'Accepted', '#accepted', data: { toggle: "tab" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
collection :side_panels, form: SidePanelForm, | |
prepopulator: ->(options) { | |
if side_panels.count == 0 | |
self.side_panels << SidePanel.new(sales_order_id: sales_order_id, collection: sales_order.collection) | |
end | |
}, | |
populator: ->(fragment:, index:, **) { | |
if fragment['panel_id'] == "" #'0' # or 'None' => nil then wouldn't need to make a None on the DB then. | |
deserialized_panel = side_panels.find { |p| p.id.to_s == fragment["id"] } | |
if deserialized_panel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ANSI Colours for coloured terminal output. | |
# John Meehan 2016 | |
# foreground color | |
"\033[30m" #BLACK_TEXT | |
"\033[31m" #RED_TEXT | |
"\033[32m" #GREEN_TEXT | |
"\033[33m" #BROWN_TEXT | |
"\033[34m" #BLUE_TEXT | |
"\033[35m" #MAGENTA_TEXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Atom packages set up. | |
# John Meehan 2016 | |
# ruby atom-setup.rb | |
[ "emmet", | |
"editor-stats", | |
"language-haml", | |
"linter", | |
"linter-ruby", | |
"linter-rubocop", | |
"linter-scss-lint", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --graph --oneline --decorate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# John Meehan 9/3/2016 | |
# Setup a clean ubuntu install | |
# run with . <filename>.sh | |
# Get password to be used with sudo commands | |
# Script still requires password entry during rvm and heroku installs | |
echo -n "Enter password to be used for sudo commands:" | |
read -s password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails Project Template | |
# Run with: | |
# rails new MyApp -T -m http://............. | |
# John Meehan 2016,2018 | |
# Set the ruby version to that of the RVM | |
def set_ruby_version | |
insert_into_file('Gemfile', "ruby '#{RUBY_VERSION}'\n", :before => /^ *gem 'rails'/, :force => false) | |
# Set the Gemset name based on the Rails app name | |
insert_into_file('Gemfile', "#ruby-gemset=#{@app_name}\n", :before => /^ *gem 'rails'/, :force => false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
require 'net/http' | |
require 'uri' | |
### | |
# Purpose: | |
# Needed to save 100 simularly named images stored remotely | |
# Result: Saves 100 png to the local ./icons/ folder | |
### |