Skip to content

Instantly share code, notes, and snippets.

$('select.select').each(function(){
var title = $(this).attr('title');
if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text();
$(this)
.css({'z-index':10,'opacity':0,'-khtml-appearance':'none'})
.after('<span class="select">' + title + '</span>')
.on('change',function(e){
val = $('option:selected',this).text();
$(this).next().text(val);
})
/**
* finish(): close database connections, etc.
*
*/
public static function finish() {
// NOTE: DO 27 Aug 2012: We DON'T want to explictly close the database here, because
// Zend's session save code still needs to write out the session data. If we closed it
// Zend would simply open another connection, doubling the load on our database server.
// Instead we let PHP auto-close when we're done.
// $GLOBALS['db']->closeConnection();
.something {
.something-else {
}
}
def get_file_list(dir=options.source_dir):
""" Returns list of all html files in specified directory (recursive) """
fileList = []
print dir
try:
for root, subFolders, files in os.walk(dir):
for file in files:
filepath = os.path.join(root,file)
if ".html" in filepath:
Plugin 'SirVer/ultisnips'
Plugin 'aalvarado/ultisnips-snippets'
Plugin 'rstacruz/vim-ultisnips-css'
var bodyParser = require('body-parser'),
express = require('express'),
http = require('http'),
sio = require('socket.io');
var app = express();
var server = http.createServer(app);
app.use(
bodyParser.json(),
express.static(__dirname+'/test-ui')
var jsonTemplates = {
"test": '{' + "\n" +
' "property": "value"' + "\n" +
'}'
};
@ptrin
ptrin / scrape.rb
Last active August 29, 2015 14:13
Small script to scrape plane data and download images from Canadian Warplane Heritage Museum website
require "fileutils"
require "httparty"
require "json"
require "nokogiri"
require "open-uri"
DOMAIN = "http://www.warplane.com/"
# strip domain from URL
def strip_domain(url)

Import and backup

  • Monthly dumps from phones, sometimes camera to ~/Pictures on laptop
  • Every time the external HD is mounted, the backup.sh script runs to sync the ~/Pictures directory to the backup dir on the external - sometimes when I'm paranoid I run it manually and check to be sure it's working correctly
#!/bin/bash
if [ -d "/Volumes/My Book" ]; then
    rsync -a /Users/perry/Pictures /Volumes/My\ Book/_backup;
    rsync -a /Users/perry/Library/Application\ Support/Google/Picasa3 /Volumes/My\ Book/_backup/Picasa\ Metadata;
fi 
#!/usr/bin/env python
import csv
import os
import re
import sys
print "Input file of pages to assess: "+sys.argv[1]
def slug(str):
"""Replace non-alphanumeric characters with hyphen"""