Skip to content

Instantly share code, notes, and snippets.

View paytonrules's full-sized avatar

Eric Smith paytonrules

View GitHub Profile
class ExternalRouter
{
private:
static ExternalRouter *_instance;
protected:
ExternalRouter();
public:
static ExternalRouter *instance();
language: objective-c
rvm: 1.9.3
script: xctool -workspace [Your Workspace] -scheme [Your Specs Scheme] -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
public class LoginDialogDriver
{
private String userName;
private String password;
private String message;
private int loginAttempts;
public LoginDialogDriver(String userName, String password)
{
this.userName = userName;
(defn- uniqueness [map key whatev]
(let [duplicate-projects (find-by-kind (:kind map) :filters [:= key (get map key)])]
(when-not (empty? duplicate-projects)
"must be unique")))
// greatest variance between the opening and closing price.
//
// The following functions may be of use:
//
// abs - takes the absolute value of an argument
//
// System.Double.Parse - converts a string argument into a
// numerical value.
//
// The following function will convert a comma separated string
require 'nokogiri'
system 'unzip Alliance.docx'
doc = Nokogiri::XML(open('word/document.xml'))
# Using Label Tag
doc.xpath("//w:fldSimple[contains(@w:instr, 'label_tag')]").each do |link|
command = link.attributes["instr"].value.match(/\#\{(.*)\}/)[1]
replacement_string = eval(command)
element.replace(Nokogiri::XML::Text.new(replacement_string, doc))
// Init the window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// cocos2d will inherit these values
[window setUserInteractionEnabled:YES];
[window setMultipleTouchEnabled:YES];
// must be called before any othe call to the director
// WARNING: FastDirector doesn't interact well with UIKit controls
// [Director useFastDirector];
-(void) initializeDirector
{
// before creating any layer, set the landscape mode
// Initialize Director
[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[Director sharedDirector] setAnimationInterval:1.0/60];
[[Director sharedDirector] setDisplayFPS:YES];
// create an openGL view inside a window
-(void) initializeDirectorWithScene:(Scene *) scene
{
// before creating any layer, set the landscape mode
// Initialize Director
[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[Director sharedDirector] setAnimationInterval:1.0/60];
[[Director sharedDirector] setDisplayFPS:YES];
// create an openGL view inside a window
[[Director sharedDirector] attachInView:window];
-(void) initializeDirector
{
[producer initializeDirectorWithWindow:window scene:[GameScene scene]];
// before creating any layer, set the landscape mode
// Initialize Director
[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[Director sharedDirector] setAnimationInterval:1.0/60];
[[Director sharedDirector] setDisplayFPS:YES];