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
// ImagePreloadingViewController - An iOS view controller for trying out different | |
// UIImage preloading strategies. Results for 1 MB png on iPhone 4S: | |
// - No preload: drawing the image right away (80 ms) | |
// - Header preload: getting the width (10 ms) and then drawing (100 ms) | |
// - Data preload: getting the data (110 ms) and then drawing (75 ms) | |
// - Draw preload: drawing it once (100 ms) and then again (20 ms) | |
// In short: preload a UIImage by drawing it. | |
// License: BSD | |
// Author: Leonard van Driel, 2012 |
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)checkForAlex { | |
// is Alex installed? | |
BOOL alexInstalled = NO; | |
NSArray *voices = [AVSpeechSynthesisVoice speechVoices]; | |
for (id voiceName in voices) { | |
if ([[voiceName valueForKey:@"name"] isEqualToString:@"Alex"]) { | |
alexInstalled = YES; |
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
# Calculate denominations in dollars, quarters, dimes and cents from a starting sum (in cents) | |
print('---------------') | |
amount = 439 | |
print('Total: ', amount) | |
dollars =(amount-amount%100)/100 | |
amount -=dollars*100 | |
quarters = (amount-amount%25)/25 |
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
// list all articles on this site | |
// https://codex.wordpress.org/Template_Tags/wp_get_archives | |
$args = array( | |
'type' => 'postbypost', | |
'limit' => '', | |
'format' => 'html', | |
'before' => '', | |
'after' => '', | |
'show_post_count' => false, | |
'echo' => 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
10 print chr$(14) | |
20 gosub 100:x=rnd(-ti):cn=1 | |
30 a$="https://youtu.be/" | |
40 for i=1 to 11 | |
50 rn=int(rnd(0)*62)+1 | |
60 a$=a$+yt$(rn) | |
70 next | |
80 print:print cn;" : ";a$ | |
85 cn=cn+1 | |
90 goto 30 |
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
5 input "qwhat is the current time (hhmm | |
ss) ";ti$ | |
10 print chr$(147):print chr$(5) | |
20 a$ = left$(ti$,2) | |
25 a$ = a$ +":" | |
30 a$ = a$ + mid$(ti$,3,2) | |
35 a$ = a$ +":" | |
40 a$ = a$ +right$(ti$,2) | |
50 gosub 200 | |
60 print chr$(19) |
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 getWordCountFromPosts () { | |
$count = 0; | |
$posts = get_posts( array( | |
'numberposts' => -1, | |
'post_type' => 'any' | |
)); | |
foreach( $posts as $post ) { | |
$count += str_word_count( strip_tags( get_post_field( 'post_content', $post->ID ))); |
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 getWordCountCommentsCurrentUser() { | |
$count = 0; | |
$user_id = get_current_user_id(); | |
$comments = get_comments( array( | |
'user_id' => $user_id | |
)); | |
foreach( $comments as $comment ) { | |
$count += str_word_count( $comment->comment_content ); | |
} |
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
<img src="/path/to/image.png"> |
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
5 print | |
10 w$="" | |
20 print "(greater than)_"; | |
30 get a$:if a$="" then 30 | |
40 a=asc(a$) | |
50 if a=13 then 200:rem return | |
60 if a=32 then 110:rem space | |
70 if a=20 then 300:rem backspace | |
100 if a<65 or a>90 then 30 | |
110 print chr$(20);a$;"D"; |