Skip to content

Instantly share code, notes, and snippets.

var _global = this;
(function() {
// constructor
function Logger() {
}
_global.Logger = Logger;
// _global.getLogger = function(){return Logger;};
function Logger() {
}
try {
Logger.debug = console.debug;
} catch (e) {
Logger.debug = function() {alert('abesi')};
}
var _global = this;
(function() {
function Logger(logLevel) {
this.logLevel = logLevel;
}
_global.Logger = Logger;
Logger.LEVEL_DEBUG = 0;
Logger.LEVEL_INFO = 1;
@akisute
akisute / gist:108758
Created May 8, 2009 12:04
Damn fuckin super-duper n00bish Sieve of Eratosthenes.
# http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
def getPrimes(num):
numbers = range(2, num)
primes = [1]
while(max(primes)*max(primes) <= max(numbers)):
p = numbers.pop(0)
primes.append(p)
for n in numbers:
if (n%p == 0): numbers.remove(n)
del primes[0]
@interface YTTextFieldCell : UITableViewCell<UITextFieldDelegate, YTCustomCell> {
id delegate;
UILabel *label;
UITextField *textField;
}
@property (nonatomic, assign) id delegate;
@property (nonatomic, retain) NSString *label;
@property (nonatomic, retain) NSString *value;
@property (nonatomic, retain) NSString *placeholder;
#import <UIKit/UIKit.h>
#import "cocos2d.h"
// this definition enables type "kCurrentTurn" or "enum _kCurrentTurn"
typedef enum _kCurrentTurn {
kCurrentTurnNone = 0,
kCurrentTurnMaru = 1,
kCurrentTurnBatu = 2,
} kCurrentTurn;
#import "SimpleAudioEngine.h"
#import "TicTacToeScene.h"
#import "MenuScene.h"
@implementation TicTacToeScene
-(id) init
{
if(self = [super init])
_CLASSNAME = None
def _createDefaultNo():
bloggers = _CLASSNAME.all().fetch(1000)
if len(bloggers) == 0:
return 1
else:
return max(bloggers, key=lambda x:x.no).no + 1
class Blogger(db.Model):
no = db.IntegerProperty(required=True, default=_createDefaultNo)
class Blogger(db.Model):
class Helper:
model = None
@classmethod
def createDefaultNo(cls):
bloggers = cls.model.all().fetch(1000)
if len(bloggers) == 0:
return 1
else:
return max(bloggers, key=lambda x:x.no).no + 1
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0