View gist:8996835
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 ExternalRouter | |
{ | |
private: | |
static ExternalRouter *_instance; | |
protected: | |
ExternalRouter(); | |
public: | |
static ExternalRouter *instance(); |
View gist:9094068
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
language: objective-c | |
rvm: 1.9.3 | |
script: xctool -workspace [Your Workspace] -scheme [Your Specs Scheme] -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO |
View gist:d5eef8e986f5fd28598a
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
public class LoginDialogDriver | |
{ | |
private String userName; | |
private String password; | |
private String message; | |
private int loginAttempts; | |
public LoginDialogDriver(String userName, String password) | |
{ | |
this.userName = userName; |
View gist:d8c27f2924b38b16cb28
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
(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"))) | |
View gist:410ed225c534827ed2ca
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
// 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 |
View doc_files_at_command_line.rb
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
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)) |
View gist:215059
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
// 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]; |
View gist:215062
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
-(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 |
View Refactoring Step One
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
-(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]; |
View gist:220429
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
-(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]; | |
OlderNewer