View gist:78356
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _global = this; | |
(function() { | |
// constructor | |
function Logger() { | |
} | |
_global.Logger = Logger; | |
// _global.getLogger = function(){return Logger;}; | |
View gist:79015
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Logger() { | |
} | |
try { | |
Logger.debug = console.debug; | |
} catch (e) { | |
Logger.debug = function() {alert('abesi')}; | |
} |
View gist:79018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _global = this; | |
(function() { | |
function Logger(logLevel) { | |
this.logLevel = logLevel; | |
} | |
_global.Logger = Logger; | |
Logger.LEVEL_DEBUG = 0; | |
Logger.LEVEL_INFO = 1; |
View gist:108758
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] |
View gist:145061
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; |
View gist:160244
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
View gist:160246
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SimpleAudioEngine.h" | |
#import "TicTacToeScene.h" | |
#import "MenuScene.h" | |
@implementation TicTacToeScene | |
-(id) init | |
{ | |
if(self = [super init]) |
View gist:172640
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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) |
View gist:172656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View THttpClient.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |
OlderNewer