Skip to content

Instantly share code, notes, and snippets.

@jeremi
jeremi / Loader.java
Created July 14, 2010 09:23
Class to load random data for the Roo demo
package com.springsource.petclinic;
import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.domain.Vet;
import com.springsource.petclinic.domain.Visit;
import com.springsource.petclinic.reference.PetType;
import com.springsource.petclinic.reference.Specialty;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
@jeremi
jeremi / fabfile.py
Created November 4, 2010 21:00
A fabfile to manage git+appengine deployement
from __future__ import with_statement
import functools
import os
import sys
from fabric.api import *
from fabric.colors import green, red, green
import datetime
import re
@jeremi
jeremi / restore_namespace_after_function.py
Created December 12, 2010 09:19
This decorator restore the original namespace after the function has been executed in appengine.
def restore_namespace_after(func):
"""Decorator that ensures that restore the original namespace after the function has
been executed in appengine."""
@functools.wraps(func)
def decorated_func(*args, **kwargs):
namespace = namespace_manager.get_namespace()
res = func(*args, **kwargs)
namespace_manager.set_namespace(namespace)
return res
return decorated_func
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.IO;
namespace ConsoleApplication1
{
@jeremi
jeremi / upload.js.diff
Created February 7, 2011 10:16
Fix upload.js
diff --git a/frameworks/foundation/views/upload.js b/frameworks/foundation/views/upload.js
index 0447687..90f534f 100644
--- a/frameworks/foundation/views/upload.js
+++ b/frameworks/foundation/views/upload.js
@@ -11,6 +11,46 @@
@author Evin Grano
*/
+// Add the bind() function to the Function prototype.
+SC.mixin(Function.prototype, {
@jeremi
jeremi / auto_resize_textarea.js
Created March 9, 2011 09:51
inspired from the jquery.autogrow-textarea.js plugin
AS.AutoResizeTextAreaView = SC.TextFieldView.extend(
/** @scope AS.AutoResizeTextAreaView.prototype */ {
isTextArea: YES,
layout: {minHeight: 50},
didCreateLayer: function() {
sc_super();
this.initAutoResize();
},
@jeremi
jeremi / test.py
Created February 8, 2012 11:50
Chosen test using selenium web driver in Python
from selenium import webdriver
def select_from_chosen(driver, id, value):
chosen = driver.find_element_by_id(id + '_chzn')
results = chosen.find_elements_by_css_selector(".chzn-results li")
found = False
for result in results:
if result.text == value:
@jeremi
jeremi / base_tests.py
Created February 9, 2012 09:47 — forked from pamelafox/base_tests.py
Python Selenium Base TestCase
import unittest
import datetime
from sys import *
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
import login_dom
class BaseTests(unittest.TestCase):
@jeremi
jeremi / selenium_dom.py
Created February 9, 2012 09:51 — forked from pamelafox/selenium_dom.py
Python Selenium Dom Helper Functions
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
// Let's add a new Email record
$parameters = array(
'session' => $sessionId,
'module' => 'Emails',
'name_value_list' => array(
array('name' => 'name', 'value' => 'email body'),
array('name' => 'from_addr', 'value' => '[email protected]'),
array('name' => 'to_addrs', 'value' => '[email protected]'),
array('name' => 'date_sent', 'value' => gmdate("Y-m-d H:i:s")),
array('name' => 'description', 'value' => 'This is an email created from a REST web services call'),