Skip to content

Instantly share code, notes, and snippets.

/* ================================================================== */
/* = Reset and some HTML 5 styles in case the browser aint so sharp = */
/* ================================================================== */
html,body,div,span,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
abbr,address,cite,code,
del,dfn,em,img,ins,kbd,q,samp,
small,strong,sub,sup,var,
a,b,i,
dl,dt,dd,ol,ul,li,
@Bodacious
Bodacious / animal_spec.rb
Created October 15, 2010 15:48
This is an example of Behaviour Driven Development...
# Here, I define my class...
class Animal
end
# and write a specification for how it should behave
# include all ruby libraries
require "rubygems"
# include rspec (ruby speccing gem)
require "rspec"
@Bodacious
Bodacious / animal_spec.rb
Created October 15, 2010 15:48
This is an example of Behaviour Driven Development...
# Here, I define my class...
class Animal
# nothing here yet
end
# and write a specification for how it should behave
# include all ruby libraries
require "rubygems"
# include rspec (ruby speccing gem)
require "rspec"
@Bodacious
Bodacious / MethodMissing.rb
Created November 23, 2010 13:07
Example of how to rewrite method_missing and respond_to? in Ruby
class CarPart
# does the method name end in _price ?
def ghost_method_condition(name)
!!name.to_s[/_price$/]
end
# rewrite method missing if the method matches ghost_method_condition
def method_missing(name, *args, &block)
super unless ghost_method_condition(name)
@Bodacious
Bodacious / CSSColumnsExample.html
Created November 25, 2010 20:44
CSS left, middle and right column with fixed middle
<!DOCTYPE html>
<html>
<head>
<style type="text/css" media="screen">
div{
height: 50em;
}
div.column{
width: 7em;
}
@Bodacious
Bodacious / SitemapPingerDemo.html
Created January 21, 2011 20:24
This is a demo of how you can notify "THE BIG 4" when your xml sitemap has been updated
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Sitemap example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var googleUrl = "www.google.com/webmasters/sitemaps/ping?sitemap=";
var yahooUrl = "http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=APPNAMEHERE&url=";
@Bodacious
Bodacious / Cookie.js
Created June 23, 2011 15:11
Cookie.js
@Bodacious
Bodacious / jquery.js
Created August 12, 2011 12:04
jQuery .html()
$("#element").empty();
$("#element").append("Some text <span> With HTML </span>");
// is the same as
$("#element").html("Some text <span> With HTML </span>");
@Bodacious
Bodacious / for_rob.rb
Created August 18, 2011 20:47
What I mean is...
# here's option one - standard way to add class methods and instance methods from a module into a class
module MyParent
# callback which is called on inclusion
def self.included(klass)
klass.extend(ClassMethods)
klass.send(:include, InstanceMethods)
end
# These are class methods added to klass
@Bodacious
Bodacious / MacBook.id_rsa.pub
Created September 13, 2011 10:03
My Public keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1gghNFnH5SkGAmjCkYX6VjA8iIbEGwZC9vruKwrBOQ07npxh3gPu2pfXDIBZUl2knV5epDfpKRqdfs+E79LcqEsco1mQ+TC+lRaZvyHF+3EXe8uPqvFKqbtOF6QlCxsRjFHU2rSjEB1NbpX+YENg3D/1yBaR6oxt6aChesf5kuwc1oP/074lADqkVmgU4Z+Eq++cqXy9/bsYvCaXRoausTeDo7rIZueJw5Imaw+vfUOejBSuV0X37uqPCmevOizAyuV9n3JoWcdnvUjuN4D9uViEh/TF+vJTtm0Rs8UwYHLjxQ0k2ByNhJcoWdXYNOm9s+SAIDy/SJaix7b9lictIQ== Gavin@Gavins-Computer.local