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
#! /usr/bin/python | |
import Adafruit_BBIO.GPIO as GPIO | |
import time | |
import random | |
#Programmer: David Evans | |
#Description: It's a basic traditional game of red light, green light, with random numbers to change between the lights! | |
#When connected properly to a beaglebone black with some LEDs, this program changes the light colors to the respective | |
#colors of the game. Just something simple to start off with my Python Beagle Bone development. Easy program, but the | |
#setup was hard. |
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
//Program: Traffic Light Simulator | |
//Programmer: David Evans | |
//Program Date: 01/15/15 | |
//Language: Node.js | |
//This is the node.js version of the program, which is basically a simple traffic light... makes me wonder why traffic lights | |
//in reality are so damn expensive >_>. I already knew I could pull this off with Node.JS via the Cloud 9 IDE that comes with | |
//my beaglebone, but I just wanted something to test that everything was in running order so that the only isolated point of | |
//failure for my python code would be my python... not my setup. Iterative development with electronics... tasty! |
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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass', '~> 3.3.7' |
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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0' |
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 'ostruct' | |
class Customer < ActiveRecord::Base | |
belongs_to :user | |
has_many :customer_projects | |
validates :first_name, :presence => {:message => 'Cannot leave first name field blank.'} | |
validates :last_name, :presence => {:message => 'Cannot leave last name field blank'} | |
validates :phone_1, :presence => {:message => 'Must enter a primary phone'} | |
validates :phone_1, :format => {:with => /\(\d{3}\)[\s]\d{3}-\d{4}/, :message => 'Invalid phone number entered.'} |
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
def reject | |
kanban_card = KanbanCard.find(params[:id]) | |
unless kanban_card.worker_id.nil? | |
worker = Worker.find(kanban_card.worker_id) | |
end | |
if kanban_card.worker_id.nil? | |
flash[:message] = 'No one likes this card already. What type of jerk rejects an already rejected card?' | |
redirect_to do_work_on_kanban_board_path(KanbanBoardColumn.find(kanban_card.kanban_board_column_id).kanban_board_id) and return |
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
def received | |
connection = ActiveRecord::Base.connection_pool.checkout | |
returned_notes_array = connection.execute("SELECT message_chain_id, note_read, note_id, sender_username, subject, body, created_at FROM (SELECT note_read, note_id FROM note_statuses WHERE note_statuses.deleted = 'f' AND note_statuses.user_id = #{current_user.id}) AS rs INNER JOIN notes ON notes.id = rs.note_id ORDER BY created_at desc") | |
ActiveRecord::Base.connection_pool.checkin(connection) | |
#Filter out messages where the only sender is the current user | |
results_with_different_senders = [] | |
current_username = User.find(current_user.id).username | |
returned_notes_array.each do |note| | |
unless note['sender_username'] == current_username |
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 g model Widget name:string price:float quantity:integer version:integer warranty_expiration_date:datetime invoid_id:integer | |
rails g model Donkey first_name:string last_name:string price:float favorite_sandwhich_type:string age:integer warranty_expiration_date:datetime invoice_id:integer | |
rails g model Invoice total_charges:float insanity_rating:integer | |
rake db:migrate |
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
class Invoice < ActiveRecord::Base | |
has_many :donkeys | |
has_many :widgets | |
end |
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
class Donkey < ActiveRecord::Base | |
belongs_to :invoice | |
end |
OlderNewer