(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| def should_crop(lines) | |
| (0..6).each do |n| | |
| return false unless lines[n].start_with? "//" | |
| end | |
| return false unless lines[7] = "" | |
| true | |
| end | |
| all_objc = Dir.glob("Classes/**/**/**/**.{m,h}") | |
| all_objc.each do |path| |
| import Cocoa | |
| var MAYBE: Bool { | |
| get { | |
| return Bool(Int(arc4random_uniform(2))) | |
| } | |
| } | |
| var thisIsTotallyAGoodIdea = MAYBE |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| - (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| return @"More"; | |
| } | |
| - (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| NSLog(@"I wanted to be a pretty public API, but then time ran out and they forgot me..."); | |
| // Hide the More/Delete menu. | |
| [self setEditing:NO animated:YES]; | |
| } |
| @import MobileCoreServices; | |
| static CFStringRef UTTypeForImageData(NSData *data) { | |
| const unsigned char * bytes = [data bytes]; | |
| if (data.length >= 8) { | |
| if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47 && bytes[4] == 0x0D && bytes[5] == 0x0A && bytes[6] == 0x1A && bytes[7] == 0x0A) { | |
| return kUTTypePNG; | |
| } | |
| } |
| var http = require('http') | |
| , mysql = require('mysql'); | |
| var client = mysql.createClient({ | |
| user: 'root', | |
| password: '' | |
| }); | |
| client.useDatabase('cookbook'); |
| /* | |
| Distributed under The MIT License: | |
| http://opensource.org/licenses/mit-license.php | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software without restriction, including | |
| without limitation the rights to use, copy, modify, merge, publish, | |
| distribute, sublicense, and/or sell copies of the Software, and to |