Skip to content

Instantly share code, notes, and snippets.

View mrandyclark's full-sized avatar

Andrew Clark mrandyclark

View GitHub Profile
@mrandyclark
mrandyclark / gist:310530
Created February 21, 2010 20:48
Grabs a JSON version of your twitter feed and displays it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Tweets</title>
<script type="text/javascript" language="javascript" src="jquery-1.4.1.min.js"></script>
<script>
@mrandyclark
mrandyclark / 20100220004952_create_posts.rb
Created February 27, 2010 20:20
Rails Polymorphic Association migrations and models, check "console.rb" to see end result
# posts migration
# posts are the parent, have many types
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.integer :user_id
t.references :content, :polymorphic => true
t.timestamps
end
@mrandyclark
mrandyclark / index.html
Created June 8, 2010 12:39
Easy jQuery Tabs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Simple Tabs</title>
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot path/to/app/current/public
DirectoryIndex index.html
puts 'Hello. What year would you like to begin with?'
@alpha_year = gets.chomp
puts 'What year would you like to end with?'
@omega_year = gets.chomp
while(@alpha_year <= @omega_year)
puts @alpha_year
puts @alpha_year%4
var startYear = 2000;
var endYear = 2020;
while(startYear <= endYear)
{
if(startYear%4 == 0 && (startYear%100 != 0 && startYear%400 != 0))
{
console.log(startYear);
}
startYear++
# If you put in a beginning year and an end year, it should spit out a list of
# all of the leap years in between.
puts 'Hello. What year would you like to begin with?'
@start_year=gets.chomp
puts 'What year would you like to end with?'
@end_year=gets.chomp
input=''
while @start_year < @end_year
var pirates = ["pirate1", "pirate2", "pirate3", "pirate4", "pirate5"];
var distanceToGo = 20;
var newPirates = true;
var getMorePirates = function(pirates) {
pirates.push(
"pirate" +
(pirates.length+1)
);
console.log("we've ordered some new pirates!");
<!-- this is the "layout" for the whole site -->
<!-- the container. should have a width and margin: 0px auto; -->
<div id="container">
<div id="header"> header </div>
<!-- this has the faux columns. bg:url(bg-image.png), overflow: hidden, etc -->
<!-- has a width ( col1 width + col1 padding + col2 width + col2 padding -->
<div id="main">
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META name="y_key" content="cad3f627043ad8fe">
<meta name="msvalidate.01" content="03698D8D9E3442108B1FE6E16A8E19EF" />
<meta name="google-site-verification" content="qFvIH3xt2gnvFYHZr2ZaSLSAL2TbRmPKpnmJAHMT-_I" />
<meta name="keywords" content="<%= @meta_keywords || "web, design, development, applications, apps, deployment, hosting, marketing, Warsaw, Indiana, South Bend, Fort Wayne, Winona Lake" %>" />
<meta name="description" content="<%= @meta_description || "Disruptive Ventures builds disruptive businesses." %>" />
<title><%= @page_title || "Disruptive Ventures, Inc." %></title>