I hereby claim:
- I am mtrovilho on github.
- I am mtrovilho (https://keybase.io/mtrovilho) on keybase.
- I have a public key whose fingerprint is ED05 8D9B 3A06 BAE9 7F10 8B96 E025 F6CB D479 563A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Install the latest Xcode, with the Command Line Tools. | |
// Install Homebrew | |
// Install aircrack-ng: | |
brew install aircrack-ng | |
// Create the following symlink: | |
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/sbin/airport | |
// Figure out which channel you need to sniff: | |
sudo airport -s |
#import <Foundation/Foundation.h> | |
#include <dlfcn.h> | |
NSDictionary *FCPrivateBatteryStatus() | |
{ | |
static mach_port_t *s_kIOMasterPortDefault; | |
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options); | |
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT); | |
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name); |
extension Character { | |
var uppercaseCharacter: Character { | |
return Character(String(self).uppercaseString) | |
} | |
var lowercaseCharacter: Character { | |
return Character(String(self).lowercaseString) | |
} | |
func isUppercaseCharacter() -> Bool { |
extension Array { | |
func shuffle() -> [Element] { | |
var shuffledCollection = self | |
var remainingElements = self.count | |
while remainingElements > 0 { | |
let currentIndex = remainingElements - 1 | |
let newIndex = Int(arc4random_uniform(UInt32(remainingElements))) | |
let temp = shuffledCollection[currentIndex] |
{ | |
"continents": { | |
"AF": "África", | |
"AN": "Antártica", | |
"AS": "Asia", | |
"EU": "Europa", | |
"NA": "América do Norte", | |
"OC": "Oceania", | |
"SA": "América do Sul" | |
}, |
return
keyword. Don't add semicolons except where syntactically demanded in statements or to separate statements on the same line.var
when let
is appropriate, especially for properties. The compiler better optimizes let
statements for items whose values will not change during their lifetime. For example, Apple writes, "It is good practice to create immutable collections in all cases where the collection does not need to change. Doing so enables the Swift compiler to optimize the performance of the collections you create."import Foundation | |
extension Dictionary { | |
func fetch(_ key: Key, defaultValue: @autoclosure () -> Value) -> Value { | |
return self[key] ?? defaultValue() | |
} | |
func fetch<T>(_ key: Key, castTo type: T.Type, defaultValue: @autoclosure () -> T) -> T { | |
return self[key] as? T ?? defaultValue() | |
} |
{ | |
"auto_complete_commit_on_tab": true, | |
"auto_complete_with_fields": true, | |
"bold_folder_labels": true, | |
"caret_style": "solid", | |
"close_windows_when_empty": true, | |
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme", | |
"create_window_at_startup": false, | |
"drag_text": false, | |
"ensure_newline_at_eof_on_save": true, |
//------------------------------------------------------------------------------ | |
// Aula 4 - 27-11-2014 - Funcional - Map, Filter, Reduce | |
//------------------------------------------------------------------------------ | |
//-- Com cenas dos proximos capitulos (Generics, Structs) | |
var numeros = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] | |
//-- Sintaxe diferente | |
reduce(numeros, 0, +) | |
reduce(numeros, 1, *) |