Skip to content

Instantly share code, notes, and snippets.

View andyvanee's full-sized avatar

Andy Vanee andyvanee

View GitHub Profile
@andyvanee
andyvanee / make_node_test_run
Created July 7, 2011 21:40
Makefile for node test and run
.PHONY: test
test:
@ echo ### App Server Starting; echo
@ node app.js >> tst_log.txt 2>&1 &
@ echo; echo '### Running Zombie Tests'; echo
@ sleep 1; node test-http/zombie_tests.js
@andyvanee
andyvanee / MacPyBash.py
Created July 20, 2011 05:04
Tying a native mac UI to shell script via PyObjC.
# 2011, andyvanee
from Foundation import *
from AppKit import *
from Cocoa import *
class LockboxAppDelegate(NSObject):
configPanel = objc.IBOutlet()
srcFolder = objc.IBOutlet()
destFolder = objc.IBOutlet()
@andyvanee
andyvanee / Rakefile
Created September 21, 2011 16:19
Rake migrate without rails
require 'active_record'
require 'yaml'
require 'mysql'
require 'logger'
task :default => :migrate
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
task :migrate => :environment do
ActiveRecord::Migrator.migrate('db/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil )
@andyvanee
andyvanee / form.html
Created December 15, 2011 20:12
PHP Smarty Form Templating
<h1>Basic Form Template</h1>
{form for=$my_form}
<!-- this is a hidden field -->
{$id.html}
<!-- Default rendering of the field -->
<p>
{if $cms_headline.error}{$cms_headline.error} <br>{/if}
{$cms_headline.label} <br>
{$cms_headline.html}
@andyvanee
andyvanee / ckeditor_config.js
Created January 31, 2012 18:12
File uploads with nterchange ckeditor.
CKEDITOR.editorConfig = function( config ) {
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.toolbar
config.toolbar = [
['Source', '-', 'Cut', 'Copy', 'PasteText', 'Link', 'Unlink'],
['Bold', 'Italic', 'NumberedList', 'BulletedList'],
['HorizontalRule', 'Table', 'Outdent', 'Indent', 'RemoveFormat'],
['Format', 'FontSize']
];
config.uiColor = '#CCC';
config.skin = 'kama';
@andyvanee
andyvanee / tree.md
Created April 24, 2012 02:26 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@andyvanee
andyvanee / jq-psuedo.js
Last active March 14, 2018 23:26
jQuery custom pseudo selectors
// Returns true if the parent element contains div.nav_level2
jQuery.expr[":"].subnav = function(obj){
return jQuery(obj).parent().find("div.nav_level2").length;
};
// Using it
$("nav li>a:subnav").click(function(ev){});
$("nav li>a").not(":subnav").css("background-image", "none");
@andyvanee
andyvanee / safari.css
Created June 5, 2012 21:42
Safari style for campfire
/* Campfire: https://nonfiction.campfirenow.com */
body.chat.with_launchbar #Tabs { min-width: 520px !important; }
body.chat.with_launchbar .Left, body.chat.with_launchbar .speak { width: 100% !important; }
body.chat.with_launchbar #input { width: 440px !important; }
body.chat.with_launchbar #Wrapper { padding-left: 0 !important; padding-right: 0 !important; }
body.chat.with_launchbar .Left .col, body.chat.with_launchbar .Full .col { padding: 5px 0 0 !important; background: #fff !important; }
body.chat.with_launchbar #todays_transcript { padding: 5px !important; }
body.chat.with_launchbar #Sidebar { right: 0 !important; }
body.chat.with_launchbar #SidebarTop, body.chat.with_launchbar #search_form, body.chat.with_launchbar #guest_access, body.chat.with_launchbar #files, body.chat.with_launchbar #room_locking { display: none !important; }
body.chat.with_launchbar #participants { background: #ebebeb !important; padding: 5px 2px 2px !important; margin-left: 60px !important; width: 110px !important; opacity: 0.8 !
function pluginsoff(){
defaults write com.apple.safari WebKitPluginsEnabled -bool false
defaults write com.apple.safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false
defaults write com.apple.safari com.apple.Safari.ReaderPageGroupIdentifier.WebKit2PluginsEnabled -bool false
}
function pluginson(){
defaults write com.apple.safari WebKitPluginsEnabled -bool true
defaults write com.apple.safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool true
defaults write com.apple.safari com.apple.Safari.ReaderPageGroupIdentifier.WebKit2PluginsEnabled -bool true
}