Skip to content

Instantly share code, notes, and snippets.

@tofumatt
tofumatt / Music To Buy.txt
Created January 29, 2010 14:18
Music I should check out
Kate Voegele
AIR (Pocket Symphony)
Hot Chip
Fever Ray
Beast (song = Mr. Hurricane)
Jennifer's Body (Soundtrack)
Supervoksen (Soundtrack)
J. Storm (song = 24 Hours A Day With You)
Cage The Elephant
Yukon Blonde
Use a Sham-Wow on a just-bathed kitten. See if it works as well on cat hair as it does on spilled cola. ftw
Give credit to Tristan.
(invert the gov.ns.ca homepage for some pretty ones)
#484772 -- sweet purple
UPDATE wp_term_taxonomy tax
LEFT JOIN
(SELECT term_taxonomy_id as relid, count(*) as cnt FROM wp_term_relationships GROUP BY relid) rel
ON tax.term_taxonomy_id = rel.relid
SET tax.count = rel.cnt
WHERE tax.count != rel.cnt;
@font-face {
font-family: "Caramella";
src: url(../fonts/Caramella_Regular.ttf) format("truetype"); }
@font-face {
font-family: "DejaVu Serif";
src: url(../fonts/DejaVuSerif.ttf) format("truetype"); }
@font-face {
font-family: "Primavera";
# Meta-method to setup before_filters on controller
# actions requiring various authorization levels.
def self.must_be(role, options={})
define_method "#{role}_required" do
unless authorized?(role)
if logged_in?
redirect_to request.referer || root_url, :alert => "You must be an #{role} to access that page."
else
redirect_to login_path, :alert => "You must be logged in to access that page."
end
@tofumatt
tofumatt / evil?.rb
Created August 31, 2010 00:41
Define methods based on database calls? Bwahahaha awful.
# Define available role checks as methods.
def after_initialize
# Define the available role check methods for each User.
(@@roles ||= Role.all).each do |role|
self.class.send(:define_method, :"#{role.slug}?") do
is = false
roles.each do |r|
is = true if r.id == Role.const_get(role.slug.upcase)
end
@tofumatt
tofumatt / font-data.css
Created May 10, 2011 15:11
Inline font-face
@font-face {
font-family: "Obviously Arial";
src: url("data:font/opentype;base64,[base64-encoded font data as a string]");
}
body {
font-family: "Obviously Arial", Helevetica, "Marker Felt", sans-serif;
}
/**
@tofumatt
tofumatt / views.py
Created June 8, 2011 19:38
Versions in Reporter
version = (Version(LATEST_BETAS[prod]).simplified or
getattr(prod, 'default_version', None))
@tofumatt
tofumatt / console.js
Created June 14, 2011 15:07
Console.log
// Try to use console.log(). If it's undefined, define an
// empty object/static method to allow console.log() use
// throughout the app without breaking anything.
try {
console.log("Testing console.log()");
} catch (e) {
// Prevent errors arising from use of console.log()
console = {
log: function(a, b) {
// Don't do anything, just define this so we can