Skip to content

Instantly share code, notes, and snippets.

View FaisalAl-Tameemi's full-sized avatar

Faisal Al-Tameemi FaisalAl-Tameemi

View GitHub Profile
angular.module('d3AngularApp', ['d3'])
.directive('d3Bars', ['$window', '$timeout', 'd3Service',
function($window, $timeout, d3Service) {
return {
restrict: 'A',
scope: {
data: '=',
label: '@',
onClick: '&'
},
@FaisalAl-Tameemi
FaisalAl-Tameemi / actions.rb
Last active January 19, 2016 21:07
erb sample
get '/contacts' do
@contacts = [
{
first_name: "Ann",
last_name: "Simon"
},
{
first_name: "Peter",
last_name: "Gabriel"
@FaisalAl-Tameemi
FaisalAl-Tameemi / lectures_notes.md
Created February 3, 2016 16:25
W1D3 Lecture Notes - Arrays, Hashes, Scope

Data Structures

Arrays

A way of storing lists in Ruby

names = ["Faisal", "Sara", "Jane"]

Homework & Questions

  • OOP Review + Examples
  • Class methods vs. Instance methods?
  • What does the keyword super do?

Stubbing

We briefly discussed what happens when RSPEC stubs a method and why we need to use the attr_reader in order to check values if a instance variable method reader has been stubbed.

gem 'activerecord'
gem 'pg'
<!DOCTYPE html>
<!-- HTML5 Hello world by kirupa - http://www.kirupa.com/html5/getting_your_feet_wet_html5_pg1.htm -->
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Hello...</title>
</head>
<body>
<section>
<h1>
@FaisalAl-Tameemi
FaisalAl-Tameemi / 01_intro_to_ruby.rb
Last active February 25, 2016 19:42
Intro To Ruby Notes -- W2D2
# string are processed literally inside computers
puts "Martin and Maggie are awesome co-workers!"
puts "here's another string"
# we can add numbers since they're the same type
puts 4 + 4
# we can add to strings (concat.) together to form a third string
puts 4.to_s + 8.to_s

Rails and Form Helpers

The reference materials used for this lecture can be found at http://api.rubyonrails.org and http://guides.rubyonrails.org.

We also have to take a quick look at rails's flash object.

Rails Flash

The flash object allows you to set temporary messages that will

require_relative('./car')
bmw = BMW.new("M4")
begin
bmw.accelerate
bmw.accelerate
rescue => e
puts e
end
@FaisalAl-Tameemi
FaisalAl-Tameemi / car.rb
Created March 9, 2016 19:36
Classes review + Module example
require_relative('./car_methods')
class Car
attr_accessor :current_speed
def initialize(model, color)
@model = model
@color = color
@current_speed = 0