Skip to content

Instantly share code, notes, and snippets.

@khanlou
khanlou / MD5StringTest.swift
Last active April 12, 2019 09:18
MD5 and SHA1 on String in Swift 3
import XCTest
@testable import <#project#>
class StringMD5Test: XCTestCase {
func testMD5() {
let string = "soroush khanlou"
XCTAssertEqual(string.md5, "954d741d14b14002d1ba88f600eee635")
@palaniraja
palaniraja / manifest.plist
Created June 28, 2011 13:46
App Manifest file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
@eddiemoya
eddiemoya / git-flip-last.sh
Last active September 6, 2018 08:55
Flip the last two commits in a branch using git-rebase, git-cherry-pick, git-update-ref, git-name-rev, and git-rev-parse. Interesting exercise using quite a bit of plumbing commands.
#!/bin/bash
branch=$(git name-rev --name-only HEAD)
git rebase --onto HEAD~2 HEAD~1 HEAD
git cherry-pick ORIG_HEAD~1
git update-ref refs/heads/$branch $(git rev-parse HEAD)
git checkout --quiet $branch
# Instead of creating an independant bash script with the code above,
# consider simply creating a git alias using the command below.
@hlung
hlung / iOS - constants declaration.m
Last active November 25, 2015 07:41
iOS - how to create constants in private and public scope
// ----------------------------------
//declaration in PRIVATE scope (for using only in your class)
// ----------------------------------
// declare in .m
static const int kTweetMaxCharacters = 140;
static NSString * const kHelloString = @"HELLO!";
// ----------------------------------
// declaration in PUBLIC scope (for using in other classes too)
// ----------------------------------
//
// UIScrollView+RACSupport.h
// Taskworld
//
// Created by Kittinun Vantasin on 8/5/15.
// Copyright (c) 2015 Taskworld. All rights reserved.
//
@import UIKit;