View Creating PDFs From WKWebView
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
// | |
// ViewController.swift | |
// WebKitPDFAndImageDemo | |
// | |
// Created by Aryaman Sharda on 2/18/23. | |
// | |
import UIKit | |
import WebKit |
View Log.swift
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 | |
enum Log { | |
enum LogLevel { | |
case info | |
case warning | |
case error | |
fileprivate var prefix: String { | |
switch self { |
View NetworkLayerDemo.swift
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
enum HTTPMethod: String { | |
case delete = "DELETE" | |
case get = "GET" | |
case patch = "PATCH" | |
case post = "POST" | |
case put = "PUT" | |
} | |
enum HTTPScheme: String { | |
case http |
View HistogramEqualization.py
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
from PIL import Image | |
# Converts image to grayscale | |
inputImage = Image.open("source.png").convert('L') | |
outputImage = Image.new('L', inputImage.size) | |
width, height = inputImage.size | |
frequency = {} |
View check-ambiguous-references.py
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 sys | |
if __name__ == '__main__': | |
arguments = sys.argv | |
# The first parameter is always the call to this executable "python3 check-ambiguous-references" which we can drop | |
arguments.pop(0) | |
ambiguous_constraints_found = False | |
# Searches through all of the modified files looking for the introduction of ambiguous constraints |
View AnalyticsManager.swift
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
// 1 | |
protocol AnalyticsProvider { | |
func sendAnalyticsEvent(named name: String, metadata: [String : Any]?) | |
} | |
// 2 | |
import FirebaseAnalytics | |
struct FirebaseAnalyticsProvider: AnalyticsProvider { | |
func sendAnalyticsEvent(named name: String, metadata: [String : Any]?) { | |
Analytics.logEvent(name, parameters: metadata) |
View LowPolygonArt.py
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 | |
import numpy as np | |
# https://github.com/jmespadero/pyDelaunay2D | |
from delaunay2D import Delaunay2D | |
from PIL import Image | |
from PIL import ImageDraw | |
# Load an image from file path | |
img = Image.open('Jaipur.jpg').convert('RGBA') |
View typing_distance.py
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
file = open('blog.txt', 'r') | |
characters = { | |
"1": 4, | |
"2": 4, | |
"3": 4, | |
"4": 4, | |
"5": 4, | |
"6": 5, | |
"7": 4, |
View LZWDecoder.py
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 sys | |
from sys import argv | |
import struct | |
from struct import * | |
def decompress(): | |
# Default values in order to read the compressed file | |
compressed_data = [] | |
next_code = 256 | |
decompressed_data = "" |
View LZWEncoder.py
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 sys | |
from sys import argv | |
from struct import * | |
def compress(): | |
# Building and initializing the dictionary. | |
dictionary_size = 256 | |
dictionary = {chr(i): i for i in range(dictionary_size)} | |
# We'll start off our phrase as empty and add characters to it as we encounter them |
NewerOlder