- Ubuntu 14.04, 16.04, or 16.10
- Open up terminal
- Install core deps:
sudo apt-get install clang libicu-dev git
import Foundation | |
import NVActivityIndicatorView | |
import ESPullToRefresh | |
public class CustomRefreshHeaderAnimator2: UIView, ESRefreshProtocol, ESRefreshAnimatorProtocol { | |
public var view: UIView { return self } | |
public var insets: UIEdgeInsets = UIEdgeInsets.zero | |
public var trigger: CGFloat = 60.0 |
const OKCupid = require('okcupidjs'); | |
var Promise = require('bluebird'); | |
var okc = Promise.promisifyAll(new OKCupid()); | |
const baseQuery = { i_want: "women", they_want: "men","maximum_age": 24, radius: 9999 }; | |
const search = async () => { | |
try { |
import * as React from "react"; | |
import * as monaco from 'monaco-editor-core/esm/vs/editor/editor.main'; | |
// (self as any).MonacoEnvironment = { | |
// getWorkerUrl: () => './editor.worker.bundle.js', | |
// }; | |
class Editor extends React.Component { |
curl
to get the JSON response for the latest releasegrep
to find the line containing file URLcut
and tr
to extract the URLwget
to download itcurl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
import Resty | |
struct Todo: Codable { | |
let id: Int | |
let title: String | |
let completed: Bool | |
} | |
enum FakeAPI: Resty { | |
case todos |
enum MyService { | |
case zen | |
case showUser(id: Int) | |
case createUser(firstName: String, lastName: String) | |
case updateUser(id: Int, firstName: String, lastName: String) | |
case showAccounts | |
} |
// MARK: - Resty Protocol Implementation | |
extension MyService: Resty { | |
var host: String { | |
return "https://jsonplaceholder.typicode.com/" | |
} | |
var path: String { | |
return "" | |
} | |
MyService.zen.request(type: [Todo].self) { result in | |
switch result { | |
case let .success(todos): | |
// Array of [Todo] | |
case let .failure(error): | |
// error | |
} | |
} |
Swift Property Wrappers Written by Mattt June 24th, 2019 Years ago, we remarked that the “at sign” (@) — along with square brackets and ridiculously-long method names — was as characteristic of Objective-C as parentheses are to Lisp or punctuation is to Perl.
Then came Swift, and with it an end to these curious little 🥨-shaped glyphs. Or so we thought.
At first, the function of @ was limited to Objective-C interoperability: @IBAction, @NSCopying, @UIApplicationMain, and so on. But in time, Swift has continued to incorporate an ever-increasing number of @-prefixed attributes.
We got our first glimpse of Swift 5.1 at WWDC 2019 by way of the SwiftUI announcement. And with each “mind-blowing” slide came a hitherto unknown attribute: @State, @Binding, @EnvironmentObject…