- Connect an iOS defice with a cable
- In QuickTime Player: Option-Cmd-N (New Movie Recording) -> Select your device from the recording menu:
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
#!/usr/bin/env python | |
import os | |
import importlib | |
for fn in os.listdir(): | |
if fn.endswith(".py"): | |
with open(fn, 'r') as f: | |
for line in f: | |
if "import" in line: |
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
#!/usr/bin/env python | |
import unittest | |
class Stack(list): | |
def push(self, item): | |
self.append(item) | |
def isEmpty(self): | |
return not self | |
def peek(self): |
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
#!/usr/bin/python | |
import unittest | |
class Node(object): | |
def __init__(self, data, children=None): | |
self.children = [] | |
self.right = None | |
self.data = data |
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
#!/usr/bin/python | |
import itertools | |
from collections import defaultdict | |
from timeit import Timer | |
class Feature(object): | |
def __init__(self, name): | |
self.name = name |
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
#!/usr/bin/env python | |
# | |
# Simple script showing how to read a mitmproxy dump file | |
# | |
### UPD: this feature is now avaiable in mitmproxy: https://github.com/mitmproxy/mitmproxy/pull/619 | |
from libmproxy import flow | |
import json, sys |
Say, you have an existing octopress blog published on github pages, here is how to configure it:
git clone https://github.com/username/username.github.io.git
cd username.github.io.git
git checkout source
mkdir _deploy
cd _deploy
git init
git remote add -t master -f origin https://github.com/username/username.github.io.git
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
NSSortDescriptor *commonLikesDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"fblikes" ascending:YES comparator:^NSComparisonResult(NSArray* obj1, NSArray* obj2) { | |
NSMutableSet *intersection1 = [NSMutableSet setWithArray:user[@"fblikes"]]; | |
[intersection1 intersectSet:[NSSet setWithArray:obj1]]; | |
NSMutableSet *intersection2 = [NSMutableSet setWithArray:user[@"fblikes"]]; | |
[intersection2 intersectSet:[NSSet setWithArray:obj2]]; | |
return [@([intersection1 count]) compare:@([intersection2 count])]; | |
}]; |
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)objectsDidLoad:(nullable NSError *)error { | |
[super objectsDidLoad:error]; | |
__block PFGeoPoint *currentLocation = [PFUser currentUser][@"location"]; | |
NSSortDescriptor *distanceDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES comparator:^NSComparisonResult(PFGeoPoint* obj1, PFGeoPoint* obj2) { | |
return [@([currentLocation distanceInMilesTo:obj1]) compare:@([currentLocation distanceInMilesTo:obj2])]; | |
}]; | |
[self setValue:[[self.objects sortedArrayUsingDescriptors:@[distanceDescriptor]] mutableCopy] forKey:@"_mutableObjects"]; |
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
a: AM/PM | |
A: 0~86399999 (Millisecond of Day) | |
c/cc: 1~7 (Day of Week) | |
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat | |
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday | |
d: 1~31 (0 padded Day of Month) | |
D: 1~366 (0 padded Day of Year) | |
OlderNewer