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
import Data.List | |
fib :: Int -> Int | |
fib 0 = 1 | |
fib 1 = 1 | |
fib n = fib (n - 1) + fib (n - 2) | |
main :: IO () | |
main = putStrLn $ intercalate ", " $ map show $ map fib [0..10] |
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
import Foundation | |
typealias NewFileCallback = (fileURL: NSURL) -> Void | |
class ScreenshotDetector: NSObject, NSMetadataQueryDelegate { | |
let query = NSMetadataQuery() | |
var newFileCallback: NewFileCallback? |
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
// ==UserScript== | |
// @name InstagramSave | |
// @namespace https://instagram-save.tonisucic.com | |
// @version 1.2 | |
// @description Enables you to save/copy images on Instagram. | |
// @author Toni S | |
// @match https://www.instagram.com/* | |
// @grant none | |
// ==/UserScript== |
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
#!/usr/bin/env python3.6 | |
"""Script for calculating rollover fees""" | |
import argparse | |
import requests | |
# One rollover for every 4 hours | |
ROLLOVER_RATE = 4 | |
# 0.02% for most currency pairs |
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
import Foundation | |
import FirebaseDatabase | |
enum ModelError: Error { | |
case invalidProperties | |
} | |
protocol Model { | |
init?(snapshot: FIRDataSnapshot) | |
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
import Foundation | |
import FirebaseDatabase | |
struct Book { | |
var id: String? | |
var isbn: String | |
var title: String | |
var authors: String | |
var year: String | |
var country: String |
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
let db = FIRDatabase.database() | |
let booksRef = db.reference(withPath: Endpoint.books.path) | |
var newBook = Book( | |
id: nil, | |
isbn: "95-0443-843-0", | |
title: "Do Androids Dream of Electric Sheep?", | |
authors: "Philip K. Dick", | |
year: "1968", | |
country: "United States", |
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
let db = FIRDatabase.database() | |
let bookRef = db.reference(withPath: Endpoint.book("-KnEUaDbm6-snUq_Ojzo").path) | |
bookRef.observeSingleEvent(of: .value, with: { snapshot in | |
guard let book = Book(snapshot: snapshot) else { return } | |
print(book.title) | |
}) |
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
import Foundation | |
protocol Rule { | |
associatedtype Option | |
var errorMessage: String { get } | |
init(_ option: Option, error: String) | |
func validate(for value: ValidatableType) -> Bool |
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
import UIKit | |
protocol ReusableView: class { | |
static var defaultReuseIdentifier: String { get } | |
} | |
extension ReusableView where Self: UIView { | |
static var defaultReuseIdentifier: String { | |
return String(describing: self) |
OlderNewer