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
const Settings = require('./Settings').shared; | |
// or | |
const Settings = require('./Settings')('~/my-app-settings.json'); | |
const { prompt } = require('inquirer'); | |
(async () => { | |
const wait = delay => new Promise(resolve => setTimeout(() => resolve(), delay)); | |
try { |
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 UIKit | |
class ViewController: UIViewController { | |
// MARK: - UI Initialization | |
// The image that we will zoom/drag | |
var imageView = UIImageView() | |
// The dark overlay layer behind the image |
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
/// Setup imageView | |
private func setupImageView() { | |
// Set the image | |
imageView.image = UIImage(named: "your-asset-name-here") | |
// Resize the content | |
imageView.contentMode = .scaleAspectFill | |
imageView.layer.masksToBounds = true | |
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
// ... ViewController | |
// Let's start | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do not forget to enable user interaction on our imageView | |
imageView.isUserInteractionEnabled = true | |
let pinch = UIPinchGestureRecognizer(target: self, action: #selector(handlePinchGesture)) |
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 ViewController: UIGestureRecognizerDelegate { | |
// that method make it works | |
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { | |
return true | |
} | |
@objc func handleZoom(_ gesture: UIPinchGestureRecognizer) { | |
switch gesture.state { | |
case .began, .changed: |
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 UIKit | |
class ViewController: UIViewController { | |
// MARK: - UI Initialization | |
// The image that we will zoom/drag | |
var imageView = UIImageView() | |
// The dark overlay layer behind the image |
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
# -*- coding: utf-8 -*- | |
import re | |
from requests import session, get | |
from bs4 import BeautifulSoup | |
from contextlib import closing | |
from requests.exceptions import RequestException | |
from tinydb import TinyDB, Query | |
db = TinyDB("products.json") |
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
// | |
// Settings.swift | |
// Stockpapers | |
// | |
// Created by Federico Vitale on 12/01/2019. | |
// Copyright © 2019 Federico Vitale. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
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
/* | |
* READ BEFORE COPY-PASTING THIS FILE | |
* - The following script is buggy | |
* - This will not work, it has been tested on May 14th 2019 and the server response is 403. | |
* - PR are welcome if someone has any workaround/solution. | |
*/ | |
const fs = require("fs"); | |
const fetch = require("isomorphic-fetch"); | |
const path = require("path"); |