Skip to content

Instantly share code, notes, and snippets.

View andreyvit's full-sized avatar

Andrey Tarantsov andreyvit

View GitHub Profile
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;
3 int
<3 X N......A
Dec
@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:]
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:
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")
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;
// 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.
//
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):
@andreyvit
andreyvit / UIPickerView_SelectionBarLabelSupport.h
Created October 23, 2009 01:08
UIPickerView category that allows to easily recreate the look and feel of UIDatePicker labeled components (HIG calls them “translucent bar labels”)
// UIPickerView_SelectionBarLabelSupport.h
//
// This file adds a new API to UIPickerView that allows to easily recreate
// the look and feel of UIDatePicker labeled components.
//
// 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.instantiations.eclipse.analisys.indexer.storage.diskmapped;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import com.instantiations.eclipse.analisys.indexer.storage.db.PagedMemoryException;
import com.instantiations.eclipse.analisys.indexer.storage.reusable.filesystem.FileObject;