Skip to content

Instantly share code, notes, and snippets.

View userow's full-sized avatar

Pavlo Vasylenko userow

View GitHub Profile
Please listen up!
I need assistance with preparation for coding session
The CodeSignal screen is meant to test general coding ability.
I’ll be asked to implement a simple coding project from a spec and develop it to the point that it passes some tests.
I should prioritize
a) writing code that passes as many tests as possible and
b) progressing through all four levels quickly.
It'll essentially be a toy simulation of an app that won't require anything except the standard library of chosen programming language.
Note there's no framework/UI or anything similar — basically, it's like the core business logic of an app, but nothing else.
It won’t test detailed knowledge of algorithms, compute systems, or machine learning.
@ramzesenok
ramzesenok / CustomSwipeActions.swift
Created March 20, 2022 17:19
SwiftUI custom swipe actions cause there are none outside of the List
struct ContentView: View {
@State var titles = ["Cell #1", "Cell #2", "Cell #3", "Cell #4"]
var body: some View {
NavigationView {
ScrollView {
VStack(spacing: 0) {
ForEach(self.titles, id: \.self) { title in
HStack {
Text(title)
@dsabanin
dsabanin / enable-xcode-debug-menu.sh
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@george-lim
george-lim / swiftlint.sh
Created January 20, 2020 00:58
A handy Xcode run script that applies SwiftLint only to new Swift codebase changes
#!/bin/bash
# Parameters
source="$(pwd)/$1" # Track folder source where diffs are checked
index=$2 # Track diff remote
project_root=${0%/*} # Track project root folder
swiftlint_path='Pods/SwiftLint/swiftlint' # Track SwiftLint path
# Parameter check
if [[ $# < 1 ]]; then
@rbrovko
rbrovko / NoteExtensionsTests.swift
Last active June 30, 2019 16:35
iOS Unit tests for task#2 (Test target - NoteTests.swift) or Playground
//
// NoteExtensionsTests.swift
// NoteTests
//
// Created by Roman Brovko on 6/18/19.
// Copyright © 2019 Roman Brovko. All rights reserved.
//
import XCTest
@testable import Note
@vladimirgoncharov
vladimirgoncharov / Semaphore.playground
Last active March 31, 2023 07:47
Using semaphore in SWIFT
import UIKit
/// -------------------------------------------------------------------
private func example1() {
let queue = DispatchQueue.global(qos: DispatchQoS.QoSClass.default)
for i in 0..<10 {
queue.async() {
print("Start: \(i)")
sleep(3)
@anitaa1990
anitaa1990 / CurvedUIView.swift
Last active May 18, 2022 16:22
A Swift extension of UIView to display a curved view
import UIKit
extension UIView {
/* Usage Example
* bgView.addBottomRoundedEdge(desiredCurve: 1.5)
*/
func addBottomRoundedEdge(desiredCurve: CGFloat?) {
@agentcooper
agentcooper / 0.README.md
Last active April 9, 2024 19:27
Telegram chat backup/export

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation

@patricklynch
patricklynch / gist:689525d466c4ada42b8e
Last active October 30, 2021 05:23
The 6 ways to unwrap optionals in Swift 2.0
// The 6 ways to uwnrap optionals in Swift 2.0
//
// Created by Patrick Lynch on 6/28/15.
// Copyright © 2015 Patrick Lynch. All rights reserved.
import Foundation
// 1. Force Unwrapping
// 2. Optional Binding
// 3. Optional Chaining
@ZevEisenberg
ZevEisenberg / resetAllSimulators.sh
Last active June 20, 2024 17:13
Reset all iOS simulators with this one weird trick
osascript -e 'tell application "iOS Simulator" to quit'
osascript -e 'tell application "Simulator" to quit'
xcrun simctl erase all