This file contains hidden or 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
| extension UIView { | |
| /// Example: call someView.nudge(0, 30) | |
| func nudge(_ dx: CGFloat, _ dy: CGFloat) { | |
| self.frame = self.frame.offsetBy(dx: dx, dy: dy) | |
| CATransaction.flush() | |
| } | |
| } | |
| extension UIView { | |
| /// Example: po UIView.root |
This file contains hidden or 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
| # http://mathworld.wolfram.com/HeartCurve.html | |
| from math import pi, sin, cos | |
| import time | |
| import numpy as np | |
| r = 1 | |
| result = [] | |
| for i in range(38): | |
| result.append([]) | |
| result[i] = list(map(lambda x: ' ', range(38))) |
This file contains hidden or 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
| from PIL import Image, ImageDraw | |
| import random | |
| from sys import argv | |
| if len(argv) != 3: | |
| print("<<script>> Image outputDir") | |
| exit(1) | |
| image_name = argv[1] | |
| out = argv[2] |
This file contains hidden or 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
| from graphviz import Digraph | |
| dot = Digraph(comment='Hunting Jobs') | |
| dot.node('A', 'You') | |
| dot.node('B', '50% - You decide to apply for a job') | |
| dot.node('C', '50% - You decide to n\'t Apply to job') | |
| dot.node('D', '20% - Pass Screening') | |
| dot.node('E', '80% - Don\'t pass screening') |
This file contains hidden or 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
| """ | |
| The basic idea is that I loop through all characters and count the number of | |
| pixels and make <Hashtable number of pixels as a key and character as value> | |
| The table will not have 255 value so to cover this I had to calculate the | |
| slope of change as a base step for the colors. | |
| example, if we have 50 value and we need 255 value, then each 255/50 = 5.1 | |
| Then with each gray color we will devied by 5 so we have index to | |
| be fetched from the keys of the pixels table |
This file contains hidden or 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
| extension UIView { | |
| func viewHierarchy(views: [UIView], prefix: String) { | |
| for view in views { | |
| print("\(spaces)-\(view)") | |
| viewHierarchy(view.subviews, spaces + " ") | |
| } | |
| func ancestry(view: UIView) { | |
| var v: UIView? = view | |
| var output = [UIView]() |
This file contains hidden or 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
| @protocol DataModalMarker | |
| @end | |
| @interface DataModalFiller : NSObject | |
| + (instancetype)sharedInstance; | |
| - (id)deserilize:(id)target; | |
| @end | |
| #import "DataModalFiller.h" |
This file contains hidden or 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
| func checkOverFlow(a: UInt32, b: UInt32) -> Bool{ | |
| let c = 0xFFFFFFFF - a | |
| return c < b; | |
| } | |
| print("\(checkOverFlow(a: 0xFFFFFFFF, b: 1))") |
This file contains hidden or 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
| class Node<T> { | |
| var left: Node? | |
| var right: Node? | |
| var value: T | |
| init(value: T, left: Node<T>?, right: Node<T>?) { | |
| self.value = value | |
| self.left = left | |
| self.right = right | |
| } |
This file contains hidden or 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
| from AppKit import NSWorkspace | |
| from time import sleep | |
| from time import time | |
| import sys | |
| if len(sys.argv) != 2: | |
| sys.exit("Usage: SCRIPT output_file.txt") | |
| file = open(sys.argv[1],"a") | |
| lastname = "" |