Instantly share code, notes, and snippets.

View rails_ramp_up.txt
1. download and install virtual box
2. download and install ubuntu 16.04
3. setup rails https://gorails.com/setup/ubuntu/16.04
4. learn https://www.railstutorial.org/book/beginning
View test_commands.txt
#Run all tests for this project
bundle exec rspec
#run single test
bundle exec rspec path/to/spec/file/thingie_spec.rb
#Useful switches
bundle exec rspec --format documentation (more output context)
bundle exec rspec --order random (tests should be able to pass in any order)
bundle exec rspec --profile (shows you slowest tests)
View working_with_popups.rb
a_popup_window = window_opened_by do
# click_button 'Open Login Window', which opens a popup
the_xpath = "//a[@id='open_popup_link']"
find(:xpath, the_xpath).click
end
within_window(a_popup_window) do
# are we focused on the popup?
expect(page).to have_selector(:xpath, "//h1[contains(text(), 'Text that appears in the H1 Tag')]")
popup_page_instance = PopupPageObj.new
View expectations.txt
# does button exist and is enabled
expect(page).to have_button('Update')
# does button exist and is disabled
expect(page).to have_button('Update', disabled: true)
# does h1 contain both of the specified strings
expect(page).to have_selector(:xpath, "//h1[contains(text(), 'New') and contains(text(), 'Person')]")
# does an input field with id of dataFirstName.1 exist
View spec_template.rb
require 'spec_helper'
RSpec.feature 'TODO: describe your spec here' do
before(:each) do
@wait_time = Capybara.default_max_wait_time
Capybara.default_max_wait_time = 10
end
scenario 'TODO: describe your scenario here.', :js do
# TODO: your logic goes here
View DataAccessObject.cfc
<!---
encapsulation is good stuff https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)
--->
<cfcomponent>
<cfset variables.dsn = '' />
<cffunction name="init">
<cfargument name="dsn" type="string" required="true" />
View burster_buster.ino
/*
* wot
* water level & low temp alert
*
* status
* water level sensor
* https://www.fasttech.com/p/3809800
* works
* active buzzer
* https://www.fasttech.com/p/1219302
View chromium_on_pi_3.txt
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser-l10n_48.0.2564.82-0ubuntu0.15.04.1.1193_all.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
sudo dpkg -i chromium-codecs-ffmpeg-extra_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
sudo dpkg -i chromium-browser-l10n_48.0.2564.82-0ubuntu0.15.04.1.1193_all.deb chromium-browser_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb
View three-led-array.pde
int timer = 100; // The higher the number, the slower the timing.
int ledPins[] = {
2, 3, 4
}; // an array of pin numbers to which LEDs are attached
int pinCount = 3; // the number of pins (i.e. the length of the array)
void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
View rando-blink.pde