Skip to content

Instantly share code, notes, and snippets.

View JamesDullaghan's full-sized avatar
🎯
Focusing

James D JamesDullaghan

🎯
Focusing
View GitHub Profile
@JamesDullaghan
JamesDullaghan / ActiveRecord_Schneems_grouping.mdown
Created April 25, 2013 22:30
ActiveRecord Schneems Grouping Tutorial Notes

#Grouping#

prods = Product.group(:price).count

Returns

puts prods
=> {573=>3, 574=>4, 575=>6, 576=>4}

The group method returns a hash of all prices, along with the count of each price. For example, there must be 3 items priced at 573

@JamesDullaghan
JamesDullaghan / ActiveRecord_Schneems_MIXMATCH.mdown
Created April 26, 2013 01:03
ActiveRecord Schneems Mixing and Matching Queries tutorial notes

#Mixing and Matching Queries#

puts Product.where(:price => 5).
             where(:name => "apple").
             order(:created_at).
             limit(55).
             joins(:users).
             where(:user => {:name => "richard"})

##Each method takes the output of the previous and adds to it##

@JamesDullaghan
JamesDullaghan / ActiveRecord_Schneems_Arrays.mdown
Created April 26, 2013 03:10
ActiveRecord Schneems Arrays tutorial notes

#Arrays# ###Using the Docs###

[1,2,3,4].each {|x| puts x + 1 }
2
3
4
5
=> [1,2,3,4]

@JamesDullaghan
JamesDullaghan / Fundimentals_Programming_Notes.mdown
Created May 5, 2013 18:29
Fundimentals of programming notes

#Fundtimentals of programming

###What is programming?

  • A computer program is a set of instructions.
  • A sequence of a set of instructions.

The art of programming is to take a larger idea and break it apart into smaller ideas.

Computers will do exactly as you tell them, so you need to make sure your instructions are right.

@JamesDullaghan
JamesDullaghan / Novation_kbd_launchpad.mdown
Created May 5, 2013 18:32
Novation Launchpad Keyboard shortcuts

#Novation Launchpad for Keyboard shortcuts

###4 Score and 7 years ago, we used keyboard shortcuts, or something...

Something I've always struggled with is remembering keyboard shortcuts. I'm not sure why. Software I grew up using, they have become engrained in memory. I'll never forget the Photoshop 6 shortcuts that became etched in my young impressionable mind. I also dislike using the mouse. It feels so inefficient to move from keyboard to mouse, especially being in flow.

##My brain is too small, helppp!

With the bombardment of great new tools, I've been forced to abandon shortcuts in most applications. This was until my brother showed me a peice of hardware he is using to produce music.

@JamesDullaghan
JamesDullaghan / ActiveRecord_Schneems_Joins_Tutorial_Notes.mdown
Created May 5, 2013 18:55
ActiveRecord Schneems Tutorial Notes on JOINS

#ActiveRecord Schneems tutorial notes#

##Joins##

class Product < ActiveRecord::Base
  belongs_to :user
end

class User < ActiveRecord::Base

has_many :products

@JamesDullaghan
JamesDullaghan / ActiveRecord_Schneems_Tutorial_Having.mdown
Created May 5, 2013 19:00
ActiveRecord Schneems Tutorial HAVING notes

#Having#

Objective : Find all of the products that have more than 5 duplicate prices

Group & Having

prods = Product.group(:price).having("count(price) > 5")
puts prods
=> [#<Product id: 1743,

user_id: 1363,

@JamesDullaghan
JamesDullaghan / Rails_tutorial_notes_Chapter_1_to_4.mdown
Created May 5, 2013 20:10
Rails tutorial Notes Chapter 1 - 4

Chapter 1 MVC Architecture

M - Model - Our objects, Its the object oriented approach to design and it encapsulates the data in the database

V - View - Presentation layer - It is what the user sees and interacts with - pages/html/css/javascript

C - Controller - Process and respond to events such as user actions and envoke changes to the model and view based on that. Its going to make decisions for us and control what happens

Conventional => Browser <-> Page <-> Database <=> Page <=> Browser

@JamesDullaghan
JamesDullaghan / Spreadsheet__csvtodb_nil_modules_Schneems.mdown
Created May 8, 2013 18:26
Schneems UT Rails Notes Spreadsheet to db, dealing with nil, modules

#Schneems UT on Rails course notes

  • Spreadsheet to DB
  • Dealing with nil
  • Modules

Spreadsheet to Database - Schneems

We need a csv file

@JamesDullaghan
JamesDullaghan / javascript_notes.mdown
Created May 24, 2013 19:00
Javascript notes from Simon Allardice's Lynda.com class/tutorial

#Javascript Notes

###Core Concepts -

  • HTMl is the markup language - CONTENT ON PAGES
  • CSS is the style sheet language - PRESENTATION ON PAGES
  • JAVASCRIPT is the programming language - BEHAVIOR ON PAGES

Javascript is a programming language. Often times javascript is referred to as a scripting language, but most programmers dismiss this and argue javascript is a programming language.