Skip to content

Instantly share code, notes, and snippets.

View sugarmo's full-sized avatar
🏠
Working from home

Steven Mok sugarmo

🏠
Working from home
View GitHub Profile
@implementation UILabel (SwizzlingExamples)
+ (void)load
{
SwizzleSelectorWithBlock_Begin(self, @selector(initWithFrame:))
^(UILabel *self, CGRect frame) {
if ((self = ((id (*)(id, SEL, CGRect))_imp)(self, _cmd, frame))) {
// ...
}
return self;
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
extension UIImage {
public func imageRotatedByDegrees(degrees: CGFloat) -> UIImage {
let radiansToDegrees: (CGFloat) -> CGFloat = {
return $0 * (180.0 / CGFloat(M_PI))
}
let degreesToRadians: (CGFloat) -> CGFloat = {
return $0 / (180.0 * CGFloat(M_PI))
}
// calculate the size of the rotated view's containing box for our drawing space
@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,
@eahrold
eahrold / HelperTool_CodeSign_RunScript.py
Created February 24, 2014 22:45
Automatically get the proper Values in a PriviledgedHelperTool's Info.plist / LaunchD
#!/usr/bin/python
''' Place this script at the root of the project directory
and enter this for a Run Script during build phase of the helper app
${PROJECT_DIR}"/HelperTool_CodeSign_RunScript.py
put the run script right after Target Dependencies
What this script does is write the SMPrivilegedExecutables dictionary
@raphaelschaad
raphaelschaad / RSTimingFunction.h
Last active March 21, 2023 08:40
All the cool animation curves from `CAMediaTimingFunction` but not limited to use with CoreAnimation. See what you can do with cubic Bezier curves here: http://netcetera.org/camtf-playground.html To get started just "Download Gist", throw the .h and .m files into your Xcode project and you're good to go!
//
// RSTimingFunction.h
//
// Created by Raphael Schaad on 2013-09-28.
// This is free and unencumbered software released into the public domain.
//
#import <UIKit/UIKit.h>
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@Weptun
Weptun / floatsign.sh
Last active January 1, 2022 21:23 — forked from mediabounds/floatsign.sh
Now fix when no entitlements are present.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
# Extension Copyright (c) 2013 Weptun Gmbh
# http://www.weptun.de
#
# Extended by Ronan O Ciosoig January 2012
#
# Extended by Patrick Blitz, April 2013
@ryanmaxwell
ryanmaxwell / ryan-objc.cfg
Last active June 26, 2019 16:41
Objective-C Uncrustify Config
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
@SaitoWu
SaitoWu / gollum.md
Created August 9, 2012 02:46
self host a gollum wiki.

nginx configuration:

user root admin;

worker_processes  1;

# pid of nginx master process
pid /var/run/nginx.pid;