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
disabled_rules: # rule identifiers to exclude from running | |
- line_length | |
- function_body_length | |
- cyclomatic_complexity | |
- multiple_closures_with_trailing_closure | |
- xctfail_message | |
# Swift 3 rules that do not make sense for Swift 2.3 | |
- implicit_getter |
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
- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch | |
{ | |
if ([gestureRecognizer isEqual:self.tapRecognizer]) { | |
// for ios 7 , need to compare with UITableViewCellContentView | |
if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"] || [touch.view.superview isKindOfClass:[UITableViewCell class]]) { | |
return FALSE; | |
} | |
} | |
return TRUE; | |
} |
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
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsdl="http://www.onvif.org/ver20/ptz/wsdl" xmlns:sch="http://www.onvif.org/ver10/schema"> | |
<soap:Header/> | |
<soap:Body> | |
<wsdl:ContinuousMove> | |
<wsdl:Velocity> | |
<!--Optional:--> | |
<sch:PanTilt x="-1" y="0" space="0"/> | |
</wsdl:Velocity> | |
<!--Optional:--> | |
</wsdl:ContinuousMove> |
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
# Python program to find the missing | |
# and additional elements | |
# source: https://www.geeksforgeeks.org/python-find-missing-additional-values-two-lists/ | |
# examples of lists | |
list1 = [1, 2, 3, 4, 5, 6] | |
list2 = [4, 5, 6, 7, 8] | |
# prints the missing and additional elements in list2 | |
print("Missing values in second list:", (set(list1).difference(list2))) |
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
#source: https://stackoverflow.com/questions/390250/elegant-ways-to-support-equivalence-equality-in-python-classes | |
class Number: | |
def __init__(self, number): | |
self.number = number | |
def __eq__(self, other): | |
"""Overrides the default implementation""" | |
if isinstance(other, Number): |
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
for i in *.heic; do sips -s format jpeg -s formatOptions best "${i}" --out "${i%heic}jpg" && touch -r "${i}" "${i%heic}jpg"; done |
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 AVFoundation | |
class ViewController { | |
private var videoPlayer: AVPlayer? | |
private var playerItem: AVPlayerItem? | |
private var layer: AVPlayerLayer? | |
func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) |
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
def recursive_dfs(graph, source,path = []): | |
if source not in path: | |
path.append(source) | |
if source not in graph: | |
# leaf node, backtrack | |
return path | |
for neighbour in graph[source]: | |
path = recursive_dfs(graph, neighbour, path) | |
return path |
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
#Breadth first search | |
# Definition for a binary tree node. | |
# class TreeNode: | |
# def __init__(self, val=0, left=None, right=None): | |
# self.val = val | |
# self.left = left | |
# self.right = right | |
class Solution: | |
def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: | |
from collections import deque |