Skip to content

Instantly share code, notes, and snippets.

@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@amitsaxena
amitsaxena / gist:8601424
Last active October 18, 2019 21:51
CustomURL: Launch app if app is installed, else open an alternate URL (iOS all browsers)
<script type="text/javascript">
var timer;
var heartbeat;
var lastInterval;
function clearTimers() {
clearTimeout(timer);
clearTimeout(heartbeat);
}
@davbeck
davbeck / WKUIDelegate.m
Last active September 28, 2023 06:59
Boilerplate implementation of WKUIDelegate to support Javascript alerts.
#pragma mark - WKUIDelegate
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
completionHandler();
@Shilo
Shilo / DeviceManager.h
Last active April 18, 2018 01:36
Objective-C methods for retrieving iOS device models. (More info here: http://www.everyi.com/by-identifier/ipod-iphone-ipad-specs-by-model-identifier.html)
#import <Foundation/Foundation.h>
@interface DeviceManager : NSObject
+ (NSString *)deviceModelName;
+ (NSString *)deviceSimpleModelName;
@end
protocol Calendar {
typealias Unit: BidirectionalIndexType
typealias Era: Unit
typealias Year: Unit
typealias Month: Unit
typealias Week: Unit
typealias Day: Unit
typealias Weekday: Unit
typealias Hour: Unit
@Ashton-W
Ashton-W / Breakpoints_v2.xcbkptlist
Last active January 25, 2023 09:28
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@xcatliu
xcatliu / (已失效)中国区用户在开启 GitHub 两步验证中遇到的问题
Last active March 7, 2024 02:53
(已失效)中国区用户在开启 GitHub 两步验证中遇到的问题
2023.8.28
据多名网友回复,此方法已失效。
最新解决办法请参考此贴:[v2ex: 请问 github 的两步验证(two-factor authentication)大家是怎么做的?](https://www.v2ex.com/t/967533)
https://www.v2ex.com/t/967533
---
@mwaterfall
mwaterfall / StringExtensionHTML.swift
Last active May 27, 2024 04:36
Decoding HTML Entities in Swift
// Very slightly adapted from http://stackoverflow.com/a/30141700/106244
// 99.99% Credit to Martin R!
// Mapping from XML/HTML character entity reference to character
// From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
private let characterEntities : [String: Character] = [
// XML predefined entities:
"&quot;" : "\"",
"&amp;" : "&",
@huang5556019
huang5556019 / gist:28adf8d4de0993b5945c
Created September 7, 2015 06:24
iOS开发教程、博客、工具、文档类站点收集整理
#国外iOS开发教程、博客、工具、文档类站点收集整理
http://www.sososwift.com/ 与Swift相关的博客汇总 ★★★★★
http://www.codingexplorer.com/ 一些不错的iOS博文内容涉及OC、Swift ★★★★★
http://www.ioscreator.com/ 赞赞赞★★★★★
http://www.appcoda.com/ 赞赞赞 ★★★★★
http://shrikar.com/ 个人技术类博客 ★★★★★
http://www.raywenderlich.com/ 这个不用说了吧 ★★★★★
http://swiftdoc.org/ 与Swift文档 ★★★★
http://www.swifttoolbox.io/ Swift开源类库整理 ★★★★★
http://swiftstub.com/ Swift Coding Online ★★★
@steve228uk
steve228uk / SRCopyableLabel.swift
Last active February 26, 2022 21:08
Copyable UILabel
//
// SRCopyableLabel.swift
//
// Created by Stephen Radford on 08/09/2015.
// Copyright (c) 2015 Cocoon Development Ltd. All rights reserved.
//
import UIKit
class SRCopyableLabel: UILabel {