Skip to content

Instantly share code, notes, and snippets.

View dimohamdy's full-sized avatar
🏠
Working from home

Dimo Hamdy dimohamdy

🏠
Working from home
View GitHub Profile
@ollieatkinson
ollieatkinson / HTTPStatusCode.swift
Last active April 15, 2024 18:34
HTTP status codes as a Swift enum.
/// This is a list of Hypertext Transfer Protocol (HTTP) response status codes.
/// It includes codes from IETF internet standards, other IETF RFCs, other specifications, and some additional commonly used codes.
/// The first digit of the status code specifies one of five classes of response; an HTTP client must recognise these five classes at a minimum.
enum HTTPStatusCode: Int, Error {
/// The response class representation of status codes, these get grouped by their first digit.
enum ResponseType {
/// - informational: This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line.
case informational
@tpae
tpae / Trie.swift
Last active May 9, 2021 20:59
Swift implementation of Trie Data Structure
import Foundation
class Node {
var val: String?
var parent: Node?
var children: [String: Node] = [:]
@Bhavdip
Bhavdip / sketch-never-ending.md
Created October 6, 2016 15:53
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@bittz
bittz / QuadPageControl.swift
Last active February 12, 2023 16:42
UIPageControl with square dots having custom size (hack).
import UIKit
class QuadPageControl: UIPageControl {
override func layoutSubviews() {
super.layoutSubviews()
guard !subviews.isEmpty else { return }
let spacing: CGFloat = 3
@jeffaburt
jeffaburt / CGFloat+PixelConversion.swift
Last active December 31, 2023 12:32
Converts pixels to points based on the screen scale
import UIKit
public extension CGFloat {
/**
Converts pixels to points based on the screen scale. For example, if you
call CGFloat(1).pixelsToPoints() on an @2x device, this method will return
0.5.
- parameter pixels: to be converted into points
@kaleksandrov
kaleksandrov / global-protect.sh
Last active April 19, 2024 03:46
Simple script that starts and stops GlobalProtect.app on Mac OSX.
#!/bin/bash
case $# in
0)
echo "Usage: $0 {start|stop}"
exit 1
;;
1)
case $1 in
start)
@arnoappenzeller
arnoappenzeller / appbuilders_2016_slides
Last active May 11, 2016 06:44
Link to all slides from App Builders 2016 (On going)
https://speakerdeck.com/jpsim/sourcekit-and-you ("SourceKit and you" by @jpsim)
https://speakerdeck.com/icanzilb/appbuilders-non-technical-ways-to-be-a-better-developer ("Non-technical ways to be a better developer" by @icanzlib)
https://speakerdeck.com/cesarvaliente/refactoring-wunderlist-for-android-episode-i-the-presentation-layer ("Refactoring Wunderlist for Android" by @CesarValiente)
https://speakerdeck.com/akosma/being-a-developer-after-40 ("Being a developer after 40" Medium Post:https://speakerdeck.com/akosma/being-a-developer-after-40 by @akosma)
http://seriot.ch/resources/talks_papers/20160426_error_handling.pdf ("Error Handling" by @nst021)
https://speakerdeck.com/vixentael/upgrading-approaches-to-the-secure-mobile-architectures ("Upgrading approaches to the secure mobile architecture" by @vixental)
http://de.slideshare.net/JohnSundell/dynamic-native-backenddriven-uis-app-builders-2016 ("Dynamic, native, backend-driven UIs" by @johnsundell)
https://speakerdeck.com/smashingmag/dirty-tricks-from-the
@joemasilotti
joemasilotti / UI Testing - Mocking Network Data
Last active January 18, 2024 03:35
Xcode UI Testing - How to mock network data
.
@avdyushin
avdyushin / ASCII.swift
Created February 15, 2016 09:59
Swift Character get ASCII code value
extension Character {
var asciiValue: Int {
get {
let s = String(self).unicodeScalars
return Int(s[s.startIndex].value)
}
}
}
@dougdiego
dougdiego / MigrateDefaults.swift
Last active March 27, 2024 00:59
Migrate NSUserDefaults to App Groups - Swift
func migrateUserDefaultsToAppGroups() {
// User Defaults - Old
let userDefaults = NSUserDefaults.standardUserDefaults()
// App Groups Default - New
let groupDefaults = NSUserDefaults(suiteName: "group.myGroup")
// Key to track if we migrated
let didMigrateToAppGroups = "DidMigrateToAppGroups"