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
# Usage e.g.: python3 unused_assets.py '/Users/DevK/MyProject' '/Users/DevK/MyProject/MyProject/Assets/Assets.xcassets' | |
# It is important to pass project folder path as first argument, assets folder path as second argument | |
# It is assumed that all the images are maintained within Assets.xcassets folder and are used either within swift files or within storyboards | |
""" | |
@author = "Devarshi Kulshreshtha" | |
@copyright = "Copyright 2020, Devarshi Kulshreshtha" | |
@license = "GPL" | |
@version = "1.0.2" | |
@contact = "kulshreshtha.devarshi@gmail.com" |
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
// | |
// PasteboardWatcher.swift | |
// PasteboardWatcher | |
// | |
// Created by Devarshi Kulshreshtha on 6/19/15.PasteboardWatcher | |
// Copyright © 2015 Devarshi Kulshreshtha. All rights reserved. | |
// | |
import Cocoa |
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 org.antlr.v4.runtime.ANTLRInputStream; | |
import org.antlr.v4.runtime.CommonTokenStream; | |
import org.antlr.v4.runtime.ParserRuleContext; | |
import org.antlr.v4.runtime.Token; | |
import org.antlr.v4.runtime.tree.*; | |
import org.antlr.v4.runtime.*; | |
import java.io.FileInputStream; | |
import java.io.InputStream; | |
import org.antlr.v4.runtime.CharStreams; |
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
export CLASSPATH=".:/usr/local/lib/antlr-4.11.1-complete.jar:$CLASSPATH" | |
alias antlr4='java -jar /usr/local/lib/antlr-4.11.1-complete.jar' | |
alias grun='java org.antlr.v4.gui.TestRig' |
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
// Generates listeners | |
antlr4 ArrayInit.g4 | |
// Compiles java listeners | |
javac -cp /usr/local/lib/antlr-4.7.1-complete.jar ArrayInit*.java |
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
extension Date { | |
static let decodeFormats: [String] = ["yyyy-MM-dd'T'HH:mm:ss.SSSZ"] | |
func encodedDateString() -> String { | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ" | |
return formatter.string(from: 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
# divide and conquer approach | |
def mergeSort(array): | |
# divides the array into sub-parts | |
length = len(array) | |
if length == 1 or length == 0: | |
# returns leaf node | |
return array | |
# obtain mid index | |
mid = length // 2 | |
# obtain left array |
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 | |
/// Protocol supporting decoding of a plist to associated data model | |
protocol PlistDecoder { | |
associatedtype PlistModel: Decodable | |
func decodedValue() -> PlistModel? | |
} | |
/// Implementation of PlistDecoder with decoding capability |
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
extension NSArrayController { | |
/// Method which can be binded in storyboard to remove all objects from array controller | |
@IBAction func removeAllObjects(sender: AnyObject) { | |
let range = NSMakeRange(0, self.arrangedObjects.count) | |
self.removeObjectsAtArrangedObjectIndexes(NSIndexSet(indexesInRange: range)) | |
} | |
} |
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
protocol Pop { | |
func moveBackToParentViewController(currentViewController: UIViewController) | |
} | |
extension Pop { | |
func moveBackToParentViewController(currentViewController: UIViewController) { | |
let transition = CATransition() | |
transition.duration = 0.5 | |
transition.type = kCATransitionMoveIn |
NewerOlder