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
import random | |
class RandomWordGenerator: | |
def __init__(self): | |
self.graph = {} | |
self.first_letters = set() | |
self.last_letters = set() | |
def insert(self, words): | |
for word in words: |
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
import Foundation | |
class RandomWordGenerator { | |
private var graph: [Character: Set<Character>] = [:] | |
private var firstLetters: Set<Character> = [] | |
private var lastLetters: Set<Character> = [] | |
func insert(words: [String]) { | |
words.forEach { word in | |
guard !word.isEmpty else { return } |
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
import argparse | |
import time | |
import os | |
def show_notification(title, subtitle, message): | |
# Play alert sound | |
os.system('afplay /System/Library/Sounds/Glass.aiff') | |
# Show notification | |
os.system(""" |
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
NSArray *items; | |
MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:@(MPMediaTypeHomeVideo) forProperty:MPMediaItemPropertyMediaType]; | |
MPMediaQuery *query = [[MPMediaQuery alloc] init]; | |
[query addFilterPredicate:predicate]; | |
items = [query items]; |
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)viewDidLoad | |
{ | |
[self buildCameraRollLibrary]; | |
} | |
- (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section; | |
{ | |
return itemList.count; | |
} |