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
| import sqlite3 | |
| import sys | |
| try: | |
| FILENAME = sys.argv[1] | |
| except IndexError: | |
| print "You must pass in a valid sqlite db." | |
| sys.exit(1) | |
| print FILENAME |
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
| """Calculate the Fibonacci sequence caching the | |
| values after each call. | |
| """ | |
| dp = {} | |
| dp[0] = 0 | |
| dp[1] = 1 | |
| def fib(n): | |
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
| from random import uniform | |
| # Variables | |
| inside = 0 | |
| outside = 0 | |
| radius = 3 | |
| total = 1000000 # Number of runs | |
| for i in xrange(total): | |
| x = uniform(-radius, radius) |
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
| finished = False | |
| def backtrack(a, k, input_data): | |
| pass | |
| def is_a_solution(a, k, input_data): | |
| pass | |
| def process_solution(a, k, input_data): |
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
| for (j=1;j<100;j++) { | |
| if (!(j%3) && !(j%5)) { | |
| console.log("FizzBuzz"); | |
| } else if (!(j%3)) { | |
| console.log("Fizz"); | |
| } else if (!(j%5)){ | |
| console.log("Buzz"); | |
| } else { | |
| console.log(j); | |
| } |
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
| <html> | |
| <script type="text/javascript"> | |
| // Test of the module pattern from Douglas Crockford's | |
| // "Javascript: The Good Parts" pages 41 & 42 | |
| console.log("Starting module test...") | |
| var serial_maker = function () { | |
| var prefix = ''; | |
| var seq = 0; | |
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
| #import <stdlib.h> | |
| for (int i=0; i<20;i++) { | |
| NSLog(@"%i", arc4random_uniform(74)); | |
| } |
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)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| Company *company = [self createCompanyForIndexPath:indexPath]; | |
| dispatch_async(dispatch_get_main_queue(), ^{ | |
| [self createNewViewWithCompany:company]; | |
| }); | |
| }); | |
| } |
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
| // 2012-01-24 16:33:29.836 MacKenzie[28439:10703] -[DetailViewController viewDidLoad] 198 viewDidLoad | |
| NSLog(@"%s %d %@", __PRETTY_FUNCTION__, __LINE__, NSStringFromSelector(_cmd)); |
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. |
OlderNewer