Skip to content

Instantly share code, notes, and snippets.

@unruthless
unruthless / .htaccess
Created July 15, 2010 22:12
.htaccess file in use on an EE website with HTML5 markup and versioned static assets.
# === ENABLE mod_rewrite =========================================
RewriteEngine on
# === SECURITY TWEAKS ============================================
# --- Stop malicious visitors from viewing -------
# --- your .htaccess rules in the browser. -------
<Files .htaccess>
@unruthless
unruthless / global_nav_behaviors.js
Created August 2, 2010 15:35
jQuery snippet to handle global navigation behavior
/*
* Global Navigation Behaviors
*
* @author Ruthie BenDor
* @updated 2-Aug-2010
*
* See in use on http://www.glad.org/styles/test
* How can I make this better?
*
*/
@unruthless
unruthless / gist:664426
Created November 5, 2010 16:46
Powderhouse Camera Project revised header
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The Powderhouse Camera Project :: Somerville MA</title>
<meta name="description" content="Annie Smidt's project to create a camera obscura out of the historic powderhouse in Nathan Tufts Park, Somerville MA. Funded in part by the Somerville Arts Council.">
<meta name="keywords" content="camera obscura, pinhole, alt-pro, alternative photography, somerville, somerville arts council, SAC, somerville arts council grant, SAC grant">
@unruthless
unruthless / EE date formatting
Created November 14, 2010 03:44
EE date formatting
<?php
/* This looks like a mess, but it works. Allow PHP for the template, set parsing to Output.
* Results in the following:
* Jan 16 - 18, 2010
* Jan 16 - Feb 18, 2010
* Jan 16, 2010 - Jan 18, 2020
*/
?>
{if event_start_datetime && event_end_datetime}{event_start_datetime format="%F %j"}<?php if ("{event_start_datetime format="%Y"}" != "{event_end_datetime format="%Y"}") { ?>, {event_end_datetime format="%Y"} <?php } ?>-<?php if (("{event_start_datetime format="%F"}" != "{event_end_datetime format="%F"}") || ("{event_start_datetime format="%Y"}" != "{event_end_datetime format="%Y"}")) { ?> {event_end_datetime format="%F"}<?php } ?>{event_end_datetime format="%j"}<?php if ("{event_start_datetime format="%Y"}" == "{event_end_datetime format="%Y"}") { ?>, {event_end_datetime format="%Y"}<?php } ?>{/if}
@unruthless
unruthless / gist:954118
Created May 3, 2011 20:07
bit of SQL for @benbrunt
SELECT
exp_channel_data.entry_id,
exp_channel_data.field_id_5 'largest'
FROM
exp_channel_data
JOIN
exp_channel_titles
ON exp_channel_data.entry_id = exp_channel_titles.entry_id
ORDER BY
exp_channel_data.field_id_5 DESC
@unruthless
unruthless / gist:975599
Created May 16, 2011 23:38
Boston Bucket List
[DONE] Get drinks at Drink
[DONE] Evaluate whether Papagayo in Fort Point has decent Mexican food
Sample the gold sauce at Blue Ribbon BBQ in Arlington
Crash the Assassins Guild at MIT on a Saturday night
Taste-test cannolis from Modern Pastry vs. Mike's Pastry in the North End
Ride a party bus
Tour the Harpoon brewery
Have cocktails and appetizers at Top of the Hub in Back Bay
Order the mac&cheese at Lord Hobo in Cambridge
Eat a cupcake from Sweet on Newbury St.
@unruthless
unruthless / gist:2416072
Created April 18, 2012 19:49
California municipalities & their URLs
# #############################################################################
# LIBRARIES
import scraperwiki
import urllib
import lxml.html as lh
import mechanize
import re
import simplejson
@unruthless
unruthless / gist:3184073
Created July 26, 2012 19:40
Parking Spot calculator logic
var qty_parking_spots,
square_feet,
qty_lubrication_or_service_bay,
qty_day_shift_employees;
// Automobile or machinery sales and service garages
// rule: 1 parking space for each 400 square feet of floor area
parking_spots = floor(square_feet / 400);
/**
* A handy class to calculate color values.
*
* @version 1.0
* @author Robert Eisele <robert@xarg.org>
* @copyright Copyright (c) 2010, Robert Eisele
* @link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
*
*/
@unruthless
unruthless / gist:4253998
Created December 10, 2012 22:40
Fruit + nut stuffing
4 tbsp butter
2 large onion, diced
4 stalks celery, diced
3 cups orange juice
0.5 cups sugar
3 cups cranberries
24 pitted prunes, halved
12 dried apricots, halved