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
@mehagel
mehagel / performance
Created June 29, 2013 18:36
performance journeling
Lanny Bassham, a World Champion and Olympic Gold Medalist rifleman, wrote a pretty good book on performing at a high level, called With Winning in Mind.
In it, he recommends keeping a performance journal for each of your practice sessions.
A perforamnce journal is:
A way to measure and record your progress
First, because you cannot manage what you do not measure.
Second, because without one you are wasting a lot of time because without if you dont know what is going onw ith your performance.
I believe that the primary benefit of a performance journal is to build Self-Image.
module Functions
def drive
@status = :driving
end
def needs_gas?
return [true,true,false].sample
end
end
@mehagel
mehagel / P8 database Schema
Created July 7, 2013 18:40
P8: Database Schema : Poll Challenge
http://min.us/lbuwvg67CwwHkU
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ -->
<!-- Active URL: http://socrates.devbootcamp.com/sql.html -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/>
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/>
@mehagel
mehagel / gist:5953394
Created July 8, 2013 23:33
Poll Database
Last login: Mon Jul 8 14:09:11 on ttys000
apprentice@dbc07 ~ $ cat << EOF > ~/.sqliterc
> .headers on
> .mode column
> EOF
apprentice@dbc07 ~ $ sqlite3 dummy.rb
-- Loading resources from /Users/apprentice/.sqliterc
SQLite version 3.7.15.1 2012-12-19 20:39:10
Enter ".help" for instructions
@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>
def tic_tac_toe
b=[]
a=["x", "o", "x", "o", "x", "x", "o", "x", "o"]
1.upto(10) do
tic_tac_toe = a.sample(9)
p board_grid = Array.new(3) { tic_tac_toe.shift(3) }
end
end
p tic_tac_toe
// 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.
//------------------------------------------------------------------------------------------------------------------