Skip to content

Instantly share code, notes, and snippets.

View VincentSit's full-sized avatar

Vincent VincentSit

View GitHub Profile
@guilhermearaujo
guilhermearaujo / UISegmentedControl+Multiline.h
Created June 9, 2014 20:46
UISegmentedControl+Multiline
//
// UISegmentedControl+Multiline.h
//
// Created by Guilherme Araújo on 6/9/14.
// Copyright (c) 2014 Guilherme Araújo. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UISegmentedControl (Multiline)
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active December 9, 2025 06:56
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@jk
jk / gist:b2a0054b97fa00dce574
Created June 17, 2014 10:35
Open app settings directly from within your iOS 8 app
// Open Settings directly for the app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
@steipete
steipete / NSFormattingContextPlayground.m
Last active December 21, 2017 17:52
NSFormattingContextDynamic got my attention, so I've digged into how this actually works. (tl;dr: _NSStringProxyForContext!)
// NSFormattingContext is new in iOS 8. For NSFormattingContextDynamic it promises is following:
// The capitalization context is determined dynamically from the set {NSFormattingContextStandalone, NSFormattingContextBeginningOfSentence, NSFormattingContextMiddleOfSentence}. For example, if a date is placed at the beginning of a sentence, NSFormattingContextBeginningOfSentence is used to format the string automatically. When this context is used, the formatter will return a string proxy that works like a normal string in most cases. After returning from the formatter, the string in the string proxy is formatted by using NSFormattingContextUnknown. When the string proxy is used in stringWithFormat:, we can determine where the %@ is and then set the context accordingly. With the new context, the string in the string proxy will be formatted again and be put into the final string returned from stringWithFormat:.
// Here's a simple example:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFor
@hzlzh
hzlzh / gist:eb87294712e78d4a96c4
Created June 24, 2014 06:36
Proxifier 走代理程序请求规则
"Alfred 2"; idea;Thunder*; iTerm; Terminal;php; Dropbox; Sparrow; "Sequel Pro"; python; ruby; wget; curl; GitHub; git-remote-https; npm; node; perl;prl*;itunes; sftp; whois;traceroute;stroke;ssh;ALiWangwang;MacUpdate*;git*;Git;fzs*;mail;flickr*;xulr*;imess*;com.apple.im*;Airmail;Adium;Prot*;Tokens;Ali*;Lite*;file*;ssh;ftp;Adobe*;PDApp*;Creative*;Vbox*;xulrunner;Virtual*;PDApp;Bit*;Domainers;fire*;plugin*;Atom*;Tokens;.com.realmacsoftware*;Xcode;java;httpd;
@snakevil
snakevil / howto-setup-transparent-proxied-router.md
Last active April 1, 2024 01:28
如何在路由器中实现透明代理?

如何在路由器中实现透明代理?

0 互联网现状

目前整个互联网环境,被破坏最严重地部分,是 Web 服务体验。当直接破坏难以实现时,就会从流程链的上下游着手,如:DNS 污染。

其它地互联网服务类型,例如:邮件,可能小部分会受到 Web 服务上下游破坏地余震,但整体上基本不受影响。

@Nyx0uf
Nyx0uf / gist:217d97f81f4889f4445a
Last active November 15, 2020 22:31
UIImage scale using vImage
-(UIImage*)mmg_imageScaledToFitSize:(CGSize)fitSize
{
// Create a vImage_Buffer from the CGImage
CGImageRef sourceRef = self.CGImage;
vImage_Buffer srcBuffer;
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo = (CGBitmapInfo)kCGImageAlphaFirst,
@idleberg
idleberg / DropboxIgnore.md
Last active June 4, 2023 12:02
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@implementation UIFont (PSPDFAdditions)
// https://gist.github.com/nuthatch/7594460
static CGFloat PSPDFMultiplicatorForPreferredContentSize(void) {
CGFloat multiplicator = 1.f;
NSString *preferredTextStyle = UIApplication.sharedApplication.preferredContentSizeCategory;
if ([preferredTextStyle isEqualToString:UIContentSizeCategoryExtraSmall]) {
multiplicator = 0.9f;
}else if ([preferredTextStyle isEqualToString:UIContentSizeCategorySmall]) {
multiplicator = 0.95f;
@santoshrajan
santoshrajan / JSONStringify.swift
Created October 12, 2014 05:36
JSON Stringify in Swift
// Author - Santosh Rajan
import Foundation
let jsonObject: [AnyObject] = [
["name": "John", "age": 21],
["name": "Bob", "age": 35],
]
func JSONStringify(value: AnyObject, prettyPrinted: Bool = false) -> String {