Skip to content

Instantly share code, notes, and snippets.

View andreyvit's full-sized avatar

Andrey Tarantsov andreyvit

View GitHub Profile
def decorator(decorator):
def decorate(func):
def decorated(*args, **kw):
return decorator(func, *args, **kw)
return decorated
return decorate
@decorator
def decor1(func, *args, **kw):
// YSTableViewCells.h
//
// A set of cells for implementing Preferences-like tables.
//
// Copyright (c) 2009, Andrey Tarantsov <andreyvit@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
package com.yoursway.common.ui.animatedimage;
import java.io.InputStream;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
diff -r 3d6ddf4fd6b0 fixture/util.py
--- a/fixture/util.py Fri Oct 02 10:20:09 2009 -0500
+++ b/fixture/util.py Mon Jan 25 05:01:47 2010 +0600
@@ -33,6 +33,7 @@
data = None
datasets = []
def setUp(self):
+ super(DataTestCase, self).setUp()
if self.fixture is None:
raise NotImplementedError("no concrete fixture to load data with")
diff -r 3d6ddf4fd6b0 fixture/loadable/loadable.py
--- a/fixture/loadable/loadable.py Fri Oct 02 10:20:09 2009 -0500
+++ b/fixture/loadable/loadable.py Mon Jan 25 05:01:47 2010 +0600
@@ -236,6 +236,8 @@
ds.meta._stored_objects.store(key, obj)
# save the instance in place of the class...
ds._setdata(key, row)
+ # allow to reference the real object via MyData.somekey_obj (non-threadsafe!)
+ setattr(type(ds), key + '_obj', obj)
if not registered:
@andreyvit
andreyvit / usertestcase.py
Created January 25, 2010 07:09
An extension to gae-testbed for testing user authentication scenarios
import os
def set_logged_in_user(email, admin=False):
if email is None or email == '':
email, domain = '', 'example.com'
admin = False
else:
domain = email[email.index('@')+1:]
3 int
<3 X N......A
Dec
package com.yoursway.fsmonitor;
import static com.yoursway.utils.YsCollections.addIfNotNull;
import static com.yoursway.utils.YsPathUtils.isChildOrParent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
# Tap as a language operator approach (say we call it ^, though it's a bad one)
# name ^
# or expr ^ ( argname )
# solves the "returning" problem
updateSize: (comp) ->
return null unless comp.isInDocument
size^: computeSize comp
$(comp.node).css { width: size.w; height: size.h }
updateSize: (comp) ->
return unless comp.isInDocument
computeSize comp >- (size)
$(comp.node).css { width: size.w; height: size.h