This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
split -b500 ~/path/to/file.txt ~/path/to/split- | |
# The number after -b is the size in bytes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python: | |
from django.shortcuts import render | |
from django.http import HttpResponse | |
def about(request): | |
return render(request, 'landing/about.html') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version = (Version(LATEST_BETAS[prod]).simplified or | |
getattr(prod, 'default_version', None)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; | |
} | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(invert the gov.ns.ca homepage for some pretty ones) | |
#484772 -- sweet purple |