Skip to content

Instantly share code, notes, and snippets.

View palmin's full-sized avatar

Anders Borum palmin

View GitHub Profile
@palmin
palmin / test.yaml
Last active August 29, 2015 14:13
comprehensive but short yaml-file for testing with highlight.js
---
receipt: Oz-Ware Purchase Invoice
date: 2012-08-06
customer:
given: Dorothy
family: Gales
items:
- part_no: A4786
descrip: Water Bucket (Filled)
@interface UIView (InspectableBorder)
@property (nonatomic, assign) IBInspectable CGFloat borderWidth;
@property (nonatomic, assign) IBInspectable CGFloat cornerRadius;
@end
@implementation UIView (InspectableBorder)
-(CGFloat)borderWidth {

Keybase proof

I hereby claim:

  • I am palmin on github.
  • I am palmin (https://keybase.io/palmin) on keybase.
  • I have a public key whose fingerprint is D6E5 1709 0C54 8B06 6311 4E19 8E87 F332 DFBA A768

To claim this, I am signing this object:

// we check if we are running as beta-app by looking at path for receipt
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSString *receiptURLString = [receiptURL path];
BOOL testFlight = ([receiptURLString rangeOfString:@"sandboxReceipt"].location != NSNotFound);
extension URLRequest {
private func quote(_ string: String) -> String {
// handle all the regular escape sequences
var text = string.replacingOccurrences(of: "\\", with: "\\\\")
text = text.replacingOccurrences(of: "\"", with: "\\\"")
text = text.replacingOccurrences(of: "\n", with: "\\\n")
text = text.replacingOccurrences(of: "\r", with: "\\\r")
text = text.replacingOccurrences(of: "\t", with: "\\\t")
return "\"\(text)\""
}

I'm Anders Borum and I make a Git client for iOS called Working Copy.

It uses libgit2 as the main dependency and the way this is included in my Xcode project is making debugging and development harder than it should be.

I have a build script that creates a static library I can use in my Xcode project which works well for the end-result, but I need a solution where the libgit2 source code is fully available in my project, letting me set breakpoints and make small changes that build immediately instead of having to run a multi-minute build-script for every change.

console.log("Hello World!")
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: pink; icon-glyph: user;
// lookup gravatar for contacts without images.
var MD5 = function (string) {
function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}
// Keep polling the memory usage (through number of wired pages) every millisecond to discover if usage
// stays below some limit.
//
// let limit = MemoryGrowthLimit(megabytes: 5)
// hardWorkingMemoryConsumingMethodCall()
// XCTAssertFalse(limit.exceeded)
//
class MemoryGrowthLimit {
private let pollingInterval = 0.001
private var constantFloatSelection = NSMakeRange(0, 0)
public override func beginFloatingCursor(at point: CGPoint) {
// remember how it starts out
constantFloatSelection = selectedRange
super.beginFloatingCursor(at: point)
}
public override func updateFloatingCursor(at point: CGPoint) {