Skip to content

Instantly share code, notes, and snippets.

View jschmid's full-sized avatar
📱

Jonas Schmid jschmid

📱
View GitHub Profile
@jschmid
jschmid / prune.sh
Created December 2, 2016 10:00
Git prune branches not on origin anymore
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
@jschmid
jschmid / playground.swift
Created September 2, 2015 08:19
Specialized errors
import UIKit
// Specialized error type
public protocol CommandError: ErrorType {}
// A command that does not have specialized errors
public enum NoCommandError: CommandError {}
// The "Authorize" method returns errors
public enum AuthorizeError: CommandError {
{
"$schemaTransformation" : "http://buzzword.org.uk/2008/jCard/transformation.js" ,
"id" : "jCard" ,
"version" : "0.1.0" ,
"title" : "jCard" ,
"description" : "This document defines the jCard data format for representing and exchanging a variety of information about an individual (e.g., formatted and structured name and delivery addresses, email address, multiple telephone numbers, photograph, logo, audio clips, etc.)." ,
"type" : "object" ,
"seeAlso" :
[
"http://microformats.org/wiki/jcard" ,
@jschmid
jschmid / docs.json
Created July 16, 2015 09:49
Couchbase chat documents
// A chatroom
{
"members": [
"user2",
"user1",
"user4"
],
"name": "still",
"type": "chatroom",
@jschmid
jschmid / sync.js
Last active August 29, 2015 14:25
Couchbase chat sync function
function(doc, oldDoc) {
if(doc._deleted) {
if(oldDoc.type == "chatroom") {
requireUser(oldDoc.user);
var roomId = oldDoc._id;
var roomMembers = oldDoc.members;
var roomChannel = "room-" + roomId;
channel(roomChannel);
access(roomMembers, roomChannel);
@jschmid
jschmid / index.js
Created July 2, 2015 12:03
How Whatsapp does the app redirection
<script>window.location = "whatsapp://r?c=212687";setTimeout(function(){window.location="http://v.whatsapp.com/212687?s=1";},0);</script>
@jschmid
jschmid / keybase.md
Created February 26, 2015 07:59
Keybase

Keybase proof

I hereby claim:

  • I am jschmid on github.
  • I am schmid (https://keybase.io/schmid) on keybase.
  • I have a public key whose fingerprint is 8590 A344 C55C 2E07 8D5C 7D87 35C9 7890 C746 5518

To claim this, I am signing this object:

@jschmid
jschmid / uncrustify.cfg
Created August 28, 2014 13:41
My Uncrustify file for Obj-C
indent_oc_block_msg_xcode_style = true
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.4.3 (252)
#
# Alignment
# ---------
@jschmid
jschmid / gist:5368a49c50f08f45895f
Created July 23, 2014 10:53
Objective-C URL encoding
+ (NSString *)encodedString:(NSString *)unescaped {
NSString *charactersToEscape = @"!*'();:@&=+$,/?%#[]\" ";
NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet];
NSString *encodedString = [unescaped stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
return encodedString;
}
@jschmid
jschmid / image_link.md
Created March 3, 2013 14:31
Image with a link using Markdown