Skip to content

Instantly share code, notes, and snippets.

View kandelvijaya's full-sized avatar
🎯
Focusing

Vijaya Prakash Kandel kandelvijaya

🎯
Focusing
View GitHub Profile
@lattner
lattner / TaskConcurrencyManifesto.md
Last active November 15, 2024 05:45
Swift Concurrency Manifesto
@radianttap
radianttap / wwdc17.sh
Created June 7, 2017 09:57
Bash script to download all HD videos + PDF slides for WWDC 2017
#!/bin/bash
#Setup the environnement
mkdir wwdc2017
cd wwdc2017
mkdir tmp_download
cd tmp_download
#Extract IDs
echo "Downloading the index"
@kandelvijaya
kandelvijaya / PrecisionTimer.swift
Created October 24, 2016 20:41
Precision Timing in iOS/OSX/Swift
//: Playground - noun: a place where code can play
import UIKit
//Most precise time keeper
// for more information on the benchmarks go to www.kandelvijaya.com
func timeBlockWithMach(_ block: () -> Void) -> TimeInterval {
var info = mach_timebase_info()
guard mach_timebase_info(&info) == KERN_SUCCESS else { return -1 }
@benjaminsnorris
benjaminsnorris / TextEditing.swift
Last active April 5, 2024 14:08
Live reload of text in UITextView while preserving cursor position and text selection
import UIKit
class TextEditing: UIViewController {
@IBOutlet weak var textView: UITextView?
func updateText(with newString: String?) {
guard let textView = textView, newString = newString, (diffRange, changedText) = diff(textView.text, newString) else { return }
guard let selectedRange = textView.selectedTextRange else { textView.text = newString; return }
textView.text = newString
@sjoerdvisscher
sjoerdvisscher / expression-problem.swift
Last active August 21, 2019 16:57
Finally tagless in Swift 3
protocol Expr {
static func lit(_ x: Int) -> Self
static func add(_ lhs: Self, _ rhs: Self) -> Self
}
extension Int : Expr {
static func lit(_ x : Int) -> Int {
return x;
}
static func add(_ lhs: Int, _ rhs: Int) -> Int {
(*
ParserLibrary_v2.fsx
Version 2 of the code for a parser library.
Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators-2/
*)
open System
@chaitanyagupta
chaitanyagupta / re-sign-ios-app.md
Last active November 5, 2024 10:25
How to re-sign an iOS app with another developer account

WARNING These steps are probably out dated and will not work.

To re-sign an iOS app with another developer account, ensure that the following are in place first.

  1. Distribution certificate of the other developer account
  2. A provisioning profile from the other developer account

Note that the Apple requires bundle IDs to be globally unique, even across accounts. So a bundle ID i.e. CFBundleIdentifier from one account can't be used in a different account, even though the team id/prefix would be different.

Ensure that the new distribution certificate is in your keychain and the new provisioning profile on your disk.