This file contains hidden or 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 draw_text_layer(TextLayer *layer) { | |
text_layer_init(layer, GRect(120,30,30,40)); | |
layer_add_child(&window.layer, layer.layer); | |
} | |
void handle_init_app(AppContextRef ctx) { | |
(void)ctx; | |
window_init(&window, "Window Name"); |
This file contains hidden or 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
~/code/pebble/pebble-sdk/pulse (master ✘)✖✹✭ ᐅ sudo pip install pyobjc-core | |
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid | |
Password: | |
Downloading/unpacking pyobjc-core | |
Running setup.py egg_info for package pyobjc-core | |
warning: no directories found matching 'Scripts' | |
warning: no directories found matching 'setup-lib' | |
warning: no directories found matching 'source-deps' | |
warning: no previously-included files matching '.DS_Store' found anywhere in distribution |
This file contains hidden or 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
/code/pebble/pebble-sdk/pulse (master ✘)✖✹✭ ᐅ sudo pip install pyobjc | |
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid | |
Requirement already satisfied (use --upgrade to upgrade): pyobjc in /Library/Python/2.7/site-packages/pyobjc-2.5.1-py2.7.egg | |
Downloading/unpacking pyobjc-core==2.5.1 (from pyobjc) | |
Running setup.py egg_info for package pyobjc-core | |
warning: no directories found matching 'Scripts' | |
warning: no directories found matching 'setup-lib' | |
warning: no directories found matching 'source-deps' | |
warning: no previously-included files matching '.DS_Store' found anywhere in distribution |
This file contains hidden or 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 handle_init(AppContextRef ctx) { | |
(void)ctx; | |
char str[100]; | |
// create our formatted string | |
mini_snprintf(str, 20, "Test: %d", 5); | |
window_init(&window, "Demo"); | |
window_stack_push(&window, true /* Animated */); |
This file contains hidden or 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
// this is firing on each ajaxSubmit once per form on the page - not just once for the current form. | |
$('form').ajaxStart(function(e) { | |
console.log("element is " + ($(e).attr('id'))); | |
return $(e).addClass('submitting'); | |
}).ajaxComplete(function(e) { | |
$("input").removeAttr("disabled"); | |
return $('form.submitting').removeClass('submitting'); | |
}); |
This file contains hidden or 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
See http://htdp2e.blogspot.com.au/2012/07/exercise-177-modify-program-from.html | |
Exercise 177: Modify the program from exercise 176 so that a player can control the left or right movement of the dropping block. Each time the player presses the "left" arrow key, the dropping block should shift one column to the left unless it is in column 0 or there is already a stack of resting blocks to its left. Similarly, each time the player presses the "right" arrow key, the dropping block should move one column to the right if possible. | |
(require racket/base) | |
(define-struct block (x y) #:transparent) | |
(define-struct tetris (block landscape)) | |
; physical constants | |
(define WIDTH 10) ; the maximal number of blocks horizontally |
This file contains hidden or 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
;See http://htdp2e.blogspot.co.nz/2012/07/exercise-176-design-interactive-program.html | |
(require racket/base) | |
; The struct block contains the blocks that make up landscape and the | |
; current falling block. We need to define this struct as transparent or | |
; the member? function won't be able to look inside it. | |
(define-struct block (x y) #:transparent) |
This file contains hidden or 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
; See http://htdp2e.blogspot.co.nz/2012/07/exercise-175-design-program-tetris.html | |
(define-struct block (x y)) | |
(define-struct tetris (block landscape)) | |
; physical constants | |
(define WIDTH 10) ; the maximal number of blocks horizontally | |
; graphical constants | |
(define SIZE 10) ; blocks are square |
This file contains hidden or 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
; How to design programs 2nd ed. Question 174 | |
; See http://htdp2e.blogspot.co.nz/2012/06/exercise-174-equip-your-program-from.html | |
; Constants | |
(define WORM-SIZE 10) | |
(define WORM-MOVE (* WORM-SIZE 2)) | |
(define WIDTH 800) ; width of the game | |
(define HEIGHT 500) ; height of the game |
This file contains hidden or 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
; Constants | |
(define WORM-SIZE 10) | |
(define WORM-MOVE (* WORM-SIZE 2)) | |
(define WIDTH 800) ; width of the game | |
(define HEIGHT 500) ; height of the game | |
(define SEGMENT (circle WORM-SIZE "solid" "red")) | |
; these structs hold the current list of worm segments, the direction |
NewerOlder