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
let str: String? = "test" | |
// Optional binding using 'if' | |
if let value = str { | |
print(value) | |
} | |
// Optional binding using guard | |
guard let value = str else { |
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 | |
rm latest.tar.gz | |
wget https://wordpress.org/latest.tar.gz | |
tar -xzvf latest.tar.gz | |
if [[ $1 ]]; then | |
mv wordpress $1 | |
cd $1 | |
else |
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
Go 19 hrs 59 mins ██████████████████▏░░ 86.7% | |
TypeScript 1 hr 19 mins █▏░░░░░░░░░░░░░░░░░░░ 5.7% | |
JSON 42 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.1% | |
JavaScript 28 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.0% | |
Vue.js 12 mins ▏░░░░░░░░░░░░░░░░░░░░ 0.9% |
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 SwiftUI | |
import UIKit | |
final class DatePickerTextField: UITextField { | |
@Binding var date: Date? | |
private let datePicker = UIDatePicker() | |
init(date: Binding<Date?>, frame: CGRect) { | |
self._date = date | |
super.init(frame: frame) |
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
// | |
// SheetHeight.swift | |
// Created by Casper Zandbergen on 17/10/2019. | |
// | |
import SwiftUI | |
import UIKit | |
extension View { | |
/// Presents a sheet. |
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 SwiftUI | |
import PlaygroundSupport | |
struct Screen: View { | |
var body: some View { | |
ScrollView { | |
VStack { | |
Text("5:45").font(.system(size: 64, weight: .thin)) | |
Text("Monday, May 11").font(.system(size: 24)) | |
}.padding(.vertical, 32) |
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 | |
import Combine | |
struct PokemonResponse: Codable{ | |
let results: [Pokemon] | |
} | |
struct Pokemon: Codable{ | |
let name: String |
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 'dart:async'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( |
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 Solution { | |
func reverse(_ x: Int) -> Int { | |
let str: String = String(x) | |
let arr = str.reversed().filter{( $0 != ".")} | |
var result: Int | |
var resStr: String = "" | |
if x == -0 { | |
return 0 | |
} |
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
// | |
// DateField.swift | |
// | |
// Created by Szymon Lorenz on 22/2/20. | |
// Copyright © 2020 Szymon Lorenz. All rights reserved. | |
// | |
import SwiftUI | |
struct DateTextField: UIViewRepresentable { |