Skip to content

Instantly share code, notes, and snippets.

View twitpic_filter.php
* when twitpic URL is found in filtered $text, download the image file
* - use curl to get info from API on actual URL (w/ temporary auth key)
* - then use that URL to download the file to local $dl_dir
* @return downloaded file path or FALSE
function _twitpic_filter_download_twitpic($pic_code) {
$pic_url = '' . $pic_code;
eethann / drupalcs_fix.sed
Created Dec 15, 2011
Simple sed script to resolve common coding standards violations.
View drupalcs_fix.sed
#!/usr/bin/env sed -f
# whitespace at end of lines
# fix comma followed by non-space character
# don't be picky, this is correct even for text!
/function/!s/\(,\)\(\S\)/\1 \2/g
# fix comments may not appear after statements
eethann / .vimrc-statusline.vim
Created Dec 15, 2011
vimrc segment for syntastic- and fugitive-enabled statusline.
View .vimrc-statusline.vim
" from
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%#warningmsg#
eethann / drupal-async-example.test.js
Created Mar 6, 2012
Drupal QUnit Async Testing Example
View drupal-async-example.test.js
// Using a jQuery queue is a bit more complicated, but worth it.
(function($) {
Drupal.tests.myBackboneApp = {
getInfo: function() {
return {
name: 'Backbone App Example',
description: 'Example of a Backbone test in Drupal QUnit',
group: 'BackboneApp'
eethann / init.el
Created Jun 4, 2012
el-git drupal init.el
View init.el
(add-to-list 'load-path "~/.emacs.d/elisp")
(add-to-list 'load-path "~/.emacs.d/elisp/php-mode")
(add-to-list 'load-path "~/.emacs.d/elisp/deft")
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "") t)
(add-to-list 'package-archives
'("melpa" . "") t)
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
eethann / gist:3160925
Created Jul 22, 2012
phptemplate to twig conversion
View gist:3160925
{% if main_menu %}
<div id="main-menu" class="navigation">
{{ theme('links__system_main_menu', {
links: main_menu,
attributes: {
id: 'main-menu-links',
class: [ links, clearfix ]
heading: {
text: t('Main menu'),
eethann / gist:3343372
Created Aug 13, 2012
emacs init.el for a Node.js REPL via js-comint
View gist:3343372
(require 'js-comint)
(setq inferior-js-program-command "node") ;; not "node-repl"
;; Use your favorited js mode here:
(add-hook 'js3-mode-hook '(lambda ()
(local-set-key "\C-x\C-e"
(local-set-key "\C-\M-x"
(local-set-key "\C-cb"
eethann / _.objMapFunctions.js
Created Aug 23, 2012
Underscore mixin with common iterator functions adapted to work with objects and maintain key/val pairs.
View _.objMapFunctions.js
// ### _.objMap
// for objects, keeps key/value associations
objMap: function (input, mapper, context) {
return _.reduce(input, function (obj, v, k) {
obj[k] =, v, k, input);
return obj;
}, {}, context);
// ### _.objFilter
View eethann-mixins.scss
/* mixin for background images */
/* from */
/* may also use compass `replace-text-with-dimensions` */
@mixin knockout($_img) {
background:url($_img) no-repeat;
eethann / branch.js
Created Oct 14, 2012
Mongoose Tree Schema
View branch.js
// An excerpt from a Mongoose model.js file for use with Express:
// Sub-document to store parent ref along with it's value (a form of caching)
var Parent = new Schema({
id: ObjectId
, text: String
// Main tree-node element schema
var Branch = new Schema({