Skip to content

Instantly share code, notes, and snippets.

View torsday's full-sized avatar

Chris Torstenson torsday

View GitHub Profile
@torsday
torsday / gist:1581155
Created January 9, 2012 04:42
Iron homeostasis and the human body

Iron homeostasis and the human body

Iron has profound effects on the human body. Too little and you'll be anemic, too much and you'll rust from the inside (hemochromatosis). By far the most common route to iron absorption is through ingestion.

Insoluble Fe3+ enters the GI tract, where it is almost entirely absorbed in the duodenum by enterocytes of the duodenal lining. Before it can be absorbed it must be reduced to Fe2+ by a ferric reductase enzyme on the brush border of the enterocytes. From here a divalent metal transporter protein then transports the iron across the enterocytes cell membrane and into the cell. This is the big step, the body now chooses to either store the iron as ferritin or ferroportin.

  • If the iron is stored as ferritin--a globular protein that is the main intracellular iron storage protein that keeps the iron soluble and non-toxic--the iron will leave the body when the cell dies and is sloughed off into the feces. Ferroportin is a transmembrane protein that transports ir
@torsday
torsday / GuessingGame.rb
Last active December 13, 2015 19:38
Here is the corrected version. My mistake was returning a value before toggling @solved for one of the branches. Thanks to Sean for seeing what my eyes were glazing over.
class GuessingGame
# this is just a crapshoot, doesn't seem to help or hinder
attr_accessor :solved
attr_accessor :answer_int
def initialize(answer_int)
@answer = answer_int
@solved = false
end
1. class Gear
2 attr_reader :chainring, :cog # <-------
3 def initialize(chainring, cog)
4 @chainring = chainring
5 @cog = cog
6 end
7
8 def ratio
9 chainring / cog.to_f # <-------
10 end
class String
def to_bool
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
@torsday
torsday / ActiveRecord.md
Last active December 16, 2015 10:39
Active Record #notes

Active Record


Active Record tracks which migrations have already been run so all you have to do is update your source and run rake db:migrate. Active Record will work out which migrations should be run. It will also update your db/schema.rb file to match the structure of your database.

INDEX


INBOX

$(document).ready(function () {
// PSEUDO-CODE:
// 1- intercept the form submission event using jQuery
// 2- prevent the default action for that event from happening
// 3- generate a random number between 1 and 6 using JavaScript
// 4- use jQuery to submit an AJAX post to the form's action
// 5- when the AJAX post is done, replace the contents of the "#die" DIV in the DOM using jQuery
$('form').on('submit', function(e){
e.preventDefault();
@torsday
torsday / html_login.html
Last active December 16, 2015 16:40
Login Components
<div class='container'>
<h1>Register</h1>
<form class='login' name='login' action='/user_create' method='post'>
<input type='text' name='first_name' placeholder='First Name'></input>
<input type='text' name='last_name' placeholder='Last Name'></input>
<input type='email' name='email' placeholder='Email'></input>
<input type='text' name='user_name' placeholder='Username'></input>
@torsday
torsday / index.html
Last active December 16, 2015 21:59 — 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>
@torsday
torsday / zoo.js
Last active December 16, 2015 21:59 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal (name, length) {
this.name = name;
this.length = length;
}
@torsday
torsday / jquery_notes.md
Last active December 16, 2015 22:19
jQuery Notes

jQuery Notes


Event Basics

  • .preventDefault()
  • The on method is useful for binding the same handler function to multiple events
    • $.fn.click, $.fn.focus, $.fn.blur, $.fn.change
    • shorthand for jQuery's $.fn.on method