Skip to content

Instantly share code, notes, and snippets.

View mehagel's full-sized avatar

Mark E Hagel mehagel

  • Melissa Data
  • Canby, OR
View GitHub Profile
class Car
@@WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels = @@WHEELS
end
def drive
@status = :driving
end
def brake
module Functions
def drive
@status = :driving
end
def needs_gas?
return [true,true,false].sample
end
end
@mehagel
mehagel / index.html
Last active December 19, 2015 19:19 — forked from dbc-challenges/index.html
4_CSS_Layout
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
// Mark & Clay
$('.users').css({'background-color': 'red', 'border': '1px solid black'})
$('.users').find('img:first').attr("src", "http://images.nationalgeographic.com/wpf/media-live/photos/000/006/cache/manatee_621_600x450.jpg");
$(':contains("Seth")').animate({'color':'red'})
//Mark & Chae
challenge 2:
$('.user:nth-child(7)').find('img').attr('src', 'https://lh4.googleusercontent.com/-Ar5TPhT5FDE/UEgpZ6j4ZiI/AAAAAAAAAIM/hHVZGV2Gaik/s640/blogger-image--991622141.jpg');

Web Preformance

Sources of slow

Database

  • n+1 queries (try :includes or join)
  • Complex joins (is there another way to find the data?)
  • Missing indexes
  • Useless indexes
  • Schema (prossibly denormalize)
@mehagel
mehagel / index.html
Created July 28, 2013 17:43 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
// DRIVER CODE: Do **NOT** change anything below this point. Your task is to implement code above to make this work.
//------------------------------------------------------------------------------------------------------------------
// Mark & Clay
$('.users').css({'background-color': 'red', 'border': '1px solid black'})
$('.users').find('img:first').attr("src", "http://images.nationalgeographic.com/wpf/media-live/photos/000/006/cache/manatee_621_600x450.jpg");
$(':contains("Seth")').animate({'color':'red'})
//Mark & Chae
challenge 2:
$('.user:nth-child(7)').find('img').attr('src', 'https://lh4.googleusercontent.com/-Ar5TPhT5FDE/UEgpZ6j4ZiI/AAAAAAAAAIM/hHVZGV2Gaik/s640/blogger-image--991622141.jpg');

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.