Skip to content

Instantly share code, notes, and snippets.

View darrarski's full-sized avatar
:octocat:
🍏🦕

Dariusz Rybicki darrarski

:octocat:
🍏🦕
View GitHub Profile
@lukeredpath
lukeredpath / LICENSE
Last active April 7, 2021 14:13
Unwrapping embedded case values in TCA test store tests
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@AliSoftware
AliSoftware / SwiftCopying.swift
Last active August 18, 2021 19:41
TypeSafe copy()/mutableCopy() (NSCopying/NSMutableCopying) in Swift
import Foundation
//: Swift type-safe protocol versions of (Mutable)Copying
protocol SwiftCopying {
associatedtype NonMutableType = Self
func clone() -> NonMutableType
}
extension SwiftCopying where Self: NSCopying {
func clone() -> NonMutableType {
return self.copy() as! NonMutableType
@aallan
aallan / speedtest-ifttt.sh
Last active May 29, 2022 15:50
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
@mackuba
mackuba / wwdc15.md
Last active August 6, 2022 17:28
New stuff from WWDC 2015

Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.

If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.

OS X El Capitan

http://www.apple.com/osx/elcapitan-preview/

  • split view - two apps side by side on full screen
@olegam
olegam / find_closest_scooter.js
Created February 9, 2019 15:28
Scriptable app script to find closest scooter in Copenhagen
let googleApiKey = '' // Insert your own key for Google Maps + Directions JS SDK here
let copenhagenBounds = {minLat: 55.5, minLong: 12.5, maxLat: 55.8, maxLong: 12.7}
let copenhagenCenter = {lat: copenhagenBounds.maxLat - copenhagenBounds.minLat, lng: copenhagenBounds.maxLong - copenhagenBounds.minLong}
let getLocation = Location.current()
// const getLocation = new Promise(resolve => resolve({latitude: 55.7, longitude: 12.5})) // hardcoded location resolver for airplane debug use
const [allTIERScooters, allVOIScooters, myLocation] = await Promise.all([getTIERScooters(copenhagenBounds), getVOIScooters(copenhagenBounds), getLocation])
console.log('My location: ' + JSON.stringify(myLocation))
if (allTIERScooters.length + allVOIScooters.length <= 0) {
@IanKeen
IanKeen / LayoutGuideProvider.swift
Created October 31, 2017 11:57
Extension for constraints pointing to either the view or safeAreaLayoutGuide depending on availability
protocol LayoutGuideProvider {
var leadingAnchor: NSLayoutXAxisAnchor { get }
var trailingAnchor: NSLayoutXAxisAnchor { get }
var leftAnchor: NSLayoutXAxisAnchor { get }
var rightAnchor: NSLayoutXAxisAnchor { get }
var topAnchor: NSLayoutYAxisAnchor { get }
var bottomAnchor: NSLayoutYAxisAnchor { get }
var widthAnchor: NSLayoutDimension { get }
var heightAnchor: NSLayoutDimension { get }
var centerXAnchor: NSLayoutXAxisAnchor { get }
@chriseidhof
chriseidhof / swiftui.swift
Last active March 15, 2023 06:53
SwiftUI - iOS
import Combine
import CoreFoundation
import CoreGraphics
import CoreText
import Darwin
import Foundation
import SwiftUI
import UIKit
import os.log
import os
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// Douglas Hill, December 2018
// Made for https://douglashill.co/reading-app/
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A table view that allows navigation and selection using a hardware keyboard.
/// Only supports a single section.
class KeyboardTableView: UITableView {
// These properties may be set or overridden to provide discoverability titles for key commands.
@mluisbrown
mluisbrown / FixBTSound.applescript
Last active June 8, 2023 19:02
AppleScript to set macOS audio input device to "Internal Microphone"
-- Sets your audio input source to "Internal Microphone"
-- Frequently needed if you use bluetooth headpohones and
-- run the Xcode iOS simulator, which will often set your
-- headphones to be the input device, resulting in a drastic
-- decrease in sound quality, and making it mono
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
end tell
@insidegui
insidegui / Data+Compression.swift
Created July 21, 2020 15:01
A wrapper for compression/decompression of Swift Data using Apple's Compression framework.
/// Created by Gui Rambo
/// This wraps Apple's Compression framework to compress/decompress Data objects.
/// It will use Compression's modern API for iOS 13+ and its old API for older versions.
/// For more information, check out Apple's documentation: https://developer.apple.com/documentation/compression
/*
Copyright 2020 Guilherme Rambo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: