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
#!/bin/bash | |
# Created by Håvard Fossli <hfossli@gmail.com> in 2013 | |
# Derived from Alexis Bezverkhyy <alexis@grapsus.net> in 2011 | |
# This is free and unencumbered software released into the public domain. | |
# For more information, please refer to <http://unlicense.org/> | |
# | |
# Description | |
# A bash script for splitting videos into several files using ffmpeg. | |
# |
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 View { | |
func hide(_ hide: Bool) -> some View { | |
HideableView(isHidden: .constant(hide), view: self) | |
} | |
func hide(_ isHidden: Binding<Bool>) -> some View { | |
HideableView(isHidden: isHidden, view: 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
import UIKit | |
public enum DisplayType { | |
case unknown | |
case iphone4 | |
case iphone5 | |
case iphone6 | |
case iphone6plus | |
static let iphone7 = iphone6 | |
static let iphone7plus = iphone6plus |
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
class AppDelegate: UIResponder, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
AppVersion.activateAndSaveCurrentVersion() | |
application.onFirstLaunch { | |
showWelcomeMessage() | |
} | |
application.onUpgrade { (previousVersion, currentVersion) in | |
migrateData(from: previousVersion, to: currentVersion) |
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
const https = require("https"); | |
function fetchStatusCode(url) { | |
return new Promise(function(resolve, reject) { | |
const req = https.request(url, res => { | |
resolve(res.statusCode); | |
}); | |
req.on("error", error => { | |
reject(error); | |
}); |
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 CGFloatEqual(CGFloat a, CGFloat b, CGFloat accuracy) | |
{ | |
#if CGFLOAT_IS_DOUBLE | |
if (fabs(a-b) < accuracy * DBL_EPSILON * fabs(a+b) || fabs(a-b) < DBL_MIN) | |
{ | |
return YES; | |
} | |
#else | |
if (fabs(a-b) < accuracy * FLT_EPSILON * fabs(a+b) || fabs(a-b) < FLT_MIN) | |
{ |
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 binascii, base64 | |
from cryptography.hazmat.backends import default_backend | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.asymmetric import ec | |
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat, load_pem_public_key, PrivateFormat, load_pem_private_key, NoEncryption | |
from cryptography.hazmat.primitives.kdf.x963kdf import X963KDF | |
from cryptography.hazmat.primitives.ciphers.aead import AESGCM |
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/swift | |
import Foundation | |
struct Config { | |
enum Environment: String { | |
case dev | |
case prod | |
} | |
var environment: Environment = .prod |
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 xcrun swift | |
import Darwin | |
import Foundation | |
struct ANSIColors { | |
static let clear = "\u{001B}[0m" | |
static let red = "\u{001B}[38;5;160m" | |
static let orange = "\u{001B}[38;5;202m" | |
static let yellow = "\u{001B}[38;5;220m" |
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
#!/bin/bash | |
first_is_earlier() { | |
y1=$(date -jf '%d.%m.%y%y' "$1" +'%Y' 2> /dev/null) | |
y2=$(date -jf '%d.%m.%y%y' "$2" +'%Y' 2> /dev/null) | |
m1=$(date -jf '%d.%m.%y%y' "$1" +'%m' 2> /dev/null) | |
m2=$(date -jf '%d.%m.%y%y' "$2" +'%m' 2> /dev/null) | |
d1=$(date -jf '%d.%m.%y%y' "$1" +'%d' 2> /dev/null) | |
d2=$(date -jf '%d.%m.%y%y' "$2" +'%d' 2> /dev/null) | |
if [ $y2 -gt $y1 ] ; then |