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 {
@palmin
palmin / gist:14300e8bf529d05e7e53
Last active September 25, 2022 07:55 — forked from shannoga/gist:1008678
Get fonts family and font names list on iOS
// List all fonts on iPhone
for (NSString* family in [UIFont familyNames]) {
NSLog(@"Family name: %@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family]) {
NSLog(@" Font name: %@", name);
}
}

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:

@palmin
palmin / Merge Pull Request.py
Last active March 30, 2023 15:39
Merge Pull Request.py
#!python2
# coding: utf-8
#
# This script is meant to be used from the Pythonista action extension when Safari is showing
# a GitHub Pull Request and will ask Working Copy to merge+pull the pull-request thus fullfulling it.
# You need to already have this repository cloned in Working Copy.
#
# It only works on public repositories, since the script lacks a way to authorize, but things
# happening in Working Copy can be fully authorized with either SSH Key or username / password.
#
// 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)\""
}
var _require_cache_ = {};
function require(name) {
let local = FileManager.local();
// look for script with the given name in iCloud documents
// and current directory adding .js to filename is not present
let resolve = function(name) {
var filename = name;
if(name.indexOf('.js') < 0) {
filename += '.js';

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.

// 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));
}