Skip to content

Instantly share code, notes, and snippets.

class EntryHandler(InboundMailHandler):
"""
Process inbound emails as entries into the database.
Every email is a new post. User must login to web interface
to edit any post details.
message object:
- subject
- sender
@staydecent
staydecent / wolf_layout_loader.php
Created October 6, 2010 22:00
WolfCMS Layout Loader
<?php
/**
* Loads any layout files(.php) contained inside the theme folders.
*
* @package wolf
* @subpackage plugin.layout_loader
*
* @author Adrian Unger <spam{at}staydecent.ca>
* @version 1.1
@staydecent
staydecent / functions.php
Created February 16, 2011 18:30
Function to Remove a top level admin menu (taken from WP trac)
<?php
/*
Function taken from http://core.trac.wordpress.org/changeset/15753
Awaiting release of WP 3.1.0
Credits: scribu
*/
if ( ! function_exists('remove_menu_page') ) {
/**
* Remove a top level admin menu
@staydecent
staydecent / videotimeline.js
Created April 4, 2011 20:38
video timelime events, lzimm halp mez
jQuery(document).ready(function($) {
var video = $('.video');
var vCount = 0; // Or own counter, for counting
var chapters = {
// seconds : selector
// I forget what data types JS has.... LOLZ
// Pythonz in my brain
1 : 'one-second'
@staydecent
staydecent / hash_password.php
Created June 10, 2011 20:18
Django's password hashing ported to PHP
<?php
private function set_password($raw_password) {
/*
Sets the password to a string of random sha1 salt
and encrypted password.
Separated by '$'
*/
$salt = substr(sha1(genRandomString().genRandomString()), 0, 5);
$hash = sha1($salt.$raw_password);
@staydecent
staydecent / media_queries.css
Created June 12, 2011 17:46
Example of various media queries for responsive web design.
/* Media queries used on blog.staydecent.ca by Adrian Unger
check my full source at:
http://blog.staydecent.ca/static/css/style-0.1.6.css */
@media only screen and (min-width:768px) and (max-width:1269px) {
/* In my particular design, I used a fluid grid limited to a
max-width of 1140px, while (if there is enough room)
pushing the menu outside of layout, requiring a total
limit of at least 1270px.
So, this first query applies to any screen-width less
@staydecent
staydecent / video_embed.php
Created October 27, 2011 05:30
Vimeo or YouTube thumb link
<?php
if (!ctype_digit($videolink)) :
// has chars other than digits == YouTube
?>
<div class="video column six<?php echo ($video_count === $last) ? ' last' : ''; ?>">
<a class="videopopup" href="http://youtube.com/v/<?php echo $videolink; ?>">
<img src="http://img.youtube.com/vi/<?php echo $videolink; ?>/0.jpg">
</a>
</div>
<?php
@staydecent
staydecent / Emmet.sublime-settings
Last active November 4, 2022 01:25
Sublime Prefs
{
"disable_tab_abbreviations_for_scopes": "string"
}
@staydecent
staydecent / build.sh
Last active December 15, 2015 19:09
Concatenates files in a single dir. Supports before ordering and nice things.
#!/bin/bash
# Concat our shit
declare -a libsBefore
declare -a helperFiles
libsBefore=(
'jquery.min.js'
'underscore-min.js'
'backbone-min.js'
@staydecent
staydecent / OceanFade-Light.tmTheme
Last active October 9, 2019 23:38
OceanFade.tmTheme — theme inspired by Light Table's Default and faded ocean moods
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>OceanFade-Light</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>