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
// Wordle Emoji Formatter | |
// | |
// Given the correct word and your guesses, generates an emoji representation and ALT text. | |
let PUZZLE_NUMBER: number = 202; | |
let WORD: string = 'slump'; | |
let GUESSES: string[] = ['clear', 'hoist', 'dumpy', 'slump']; | |
// --- |
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
NSString *fileName = @"foo.json"; | |
NSURL *documentsFolderURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; | |
NSString *filePath = [documentsFolderURL.path stringByAppendingString:fileName]; | |
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL]; | |
NSError *jsonError; | |
NSMutableDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError]; |
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
NSArray *allUrlsInDirectory = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; | |
NSURL *documentsFolderURL = [allUrlsInDirectory lastObject]; |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
exec:{ | |
build:{ | |
command:"phonegap build ios", | |
stdout:true, | |
stderror:true | |
} |
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
{ | |
"name": "YourAppHere", | |
"version": "0.0.1", | |
"devDependencies": { | |
"grunt": "~0.4.2", | |
"grunt-contrib-jshint": "~0.6.3", | |
"grunt-contrib-nodeunit": "~0.2.0", | |
"grunt-contrib-uglify": "~0.2.2" | |
}, | |
"dependencies": { |
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)goToFirstPage:(id)sender { | |
int currentPage = [[self.pager.viewControllers objectAtIndex:0] idx]; | |
// Don't do anything if we're already at the first page | |
if (currentPage =< 0) { | |
return; | |
} | |
// Instead get the view controller of the first page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:0]; |
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)goToPreviousPage:(id)sender { | |
int currentPage = [[self.pager.viewControllers objectAtIndex:0] idx]; | |
// Don't do anything if we're already at the first page | |
if (currentPage =< 0) { | |
return; | |
} | |
// Instead get the view controller of the previous page | |
SomePageViewController *newInitialViewController = (SomePageViewController *)[self viewControllerAtIndex:(currentPage - 1)]; |
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
// Assuming property UIPageViewController *pager. | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Create it. | |
self.pager = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; | |
// Point the datasource back to this UIViewController. |
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
// Assuming again pageViewController.viewControllers returns the | |
// NSArray of UIViewControllers and the object at index 0 is the | |
// current view controller---which has a property idx indicating | |
// the current page. | |
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController { | |
int currentPage = [[pageViewController.viewControllers objectAtIndex:0] idx]; | |
return currentPage; | |
} |
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
// Assuming SomePageViewController has a property called idx that holds its page number. | |
// Some number | |
#define MAX_PAGES 5 | |
// Factory method | |
- (UIViewController *)viewControllerAtIndex:(int)i { | |
// Asking for a page that is out of bounds?? | |
if (i<0) { | |
return nil; |
NewerOlder