Skip to content

Instantly share code, notes, and snippets.

View josip's full-sized avatar

Josip Lisec josip

View GitHub Profile
(function ($) {
/** Watch for changes on CSS properties
* @param {String} property CSS attribute
* @param {String} id Watcher ID, used later for "un-watching"
* @param {Function} fn Function to get called when attribute changes. As first argument function receives new value, +this+ inside function refers to element.
* @returns {jQuery}
*/
$.fn.watch = function (property, id, fn) {
id += "Watcher";
(function () {
var r = /{(\w+)}/g;
window._ = function (s, d) {
if(!s)
return "";
if(!d)
return s;
return s.replace(r, function (c, p) {
// For use with MooTools
// Published under MIT license
window.Comparable = new Class({
// You class needs to implement "compareTo" method
// with same signature:
// compareTo: function (other) {
// if(this < other) return -1;
// if(this > other) return 1;
// return 0;
import sys
import re
changes_re = re.compile('^(\-{3}|\+{3}) (.+)\s+\d{4}\-\d{2}-\d{2}.*$')
lines = open(sys.argv[0], 'r').readlines()
diffs = {}
last_path = ''
for line in lines:
path = changes_re.findall(line)
def generate_slug_from_title
self[:slug] = self[:title].downcase.gsub(/[^a-z0-9]/,'-').squeeze('-').gsub(/^\-|\-$/,'') if new_document?
end
<?php
/*
Usage:
class Custom_Pdf_Generator extends Pdf_Generator {
public drawEntityInRow($order) {
$this->drawRow(array(
$order->getId(),
$order->getCreatedDate(),
import windmill
from windmill.bin import admin_lib
admin_lib.configure_global_settings()
windmill.settings['TEST_URL'] = "http://127.0.0.1:3456/"
windmill.settings['START_FIREFOX'] = True
windmill.settings['JAVASCRIPT_TEST_DIR'] = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tests")
admin_lib.setup()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, shutil, sys
from setuptools import find_packages, setup
from setuptools.command import sdist
from setuptools import Command
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
# Note: may be Apache 2.0 license-contaminated.
# (I haven't checked whether there is a significant license compatibility issue here.)
import os, logging
import tempfile
import windmill
from windmill.bin import admin_lib
from twisted.internet import defer
from foolscap.api import eventually
from allmydata.util import log, fileutil
2010-05-14 17:12:23+0200 [-] Log opened.
2010-05-14 17:12:23+0200 [-] twistd 10.0.0 (/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python 2.6.5) starting up.
2010-05-14 17:12:23+0200 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2010-05-14 17:12:23+0200 [-] foolscap.pb.Listener starting on 51817
2010-05-14 17:12:23+0200 [-] twisted.protocols.ftp.FTPFactory starting on 8021
2010-05-14 17:12:23+0200 [-] Starting factory <twisted.protocols.ftp.FTPFactory instance at 0x207b170>
2010-05-14 17:12:23+0200 [-] allmydata.frontends.sftpd.SSHFactory starting on 8022
2010-05-14 17:12:23+0200 [-] Starting factory <allmydata.frontends.sftpd.SSHFactory instance at 0x2091e90>
2010-05-14 17:12:23+0200 [-] nevow.appserver.NevowSite starting on 3456
2010-05-14 17:12:23+0200 [-] Starting factory <nevow.appserver.NevowSite instance at 0x76ca80>