Skip to content

Instantly share code, notes, and snippets.

View binho's full-sized avatar

Cleber Santos binho

View GitHub Profile
@serayuzgur
serayuzgur / Evernote2Notes.scpt
Created October 20, 2015 08:10
Exports from Evernote imports to Apple Notes iCloud Account.
tell application "Evernote"
set _Notebooks to every notebook
repeat with _NoteBook in _Notebooks
set _NoteBookName to name of _NoteBook
set _Notes to every note of _NoteBook
@nickfrey
nickfrey / WFSimulate3DTouchPreview.m
Created September 22, 2015 20:13
Test 3D Touch peek/pop using private APIs
@interface UIPreviewForceInteractionProgress : NSObject
- (void)endInteraction:(BOOL)arg1;
@end
@interface UIPreviewInteractionController : NSObject
@property (nonatomic, readonly) UIPreviewForceInteractionProgress *interactionProgressForPresentation;
@17twenty
17twenty / GoWithC.go
Last active July 11, 2016 04:29
Cross Compiling and Language Interop oh my!
package main
import (
"./binding"
"fmt"
)
func main() {
binding.PrintHello()
binding.Seed(1)
fmt.Println(binding.Random())
@DougFischer
DougFischer / XCodeRefactorNeededPostBuildScript.sh
Created August 6, 2015 20:59
Xcode post build script to display a warning suggesting class refactors when your code has more than 600 lines.
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 wc -l | awk '$1 > 600 && $2 != "total" {for(i=2;i<NF;i++){printf "%s%s", $i, " "} print $NF ":1: warning: File more than 600 lines (" $1 "), consider refactoring." }'
@DougFischer
DougFischer / XCodeTurnTODOandFIXMEintoWarnings.sh
Last active September 9, 2016 21:58
Put this code as post build script on XCode to turn TODO, NOT_IMPLEMENTED and FIXME into XCode warnings.
KEYWORDS="TODO|NOT_IMPLEMENTED|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -and \( -path "${SRCROOT}/Pods/*" -prune -o -print0 \) | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
extension UIView {
func constraintsEqualToSuperview(_ edgeInsets: UIEdgeInsets = UIEdgeInsets.zero, priority: UILayoutPriority = 1000) -> [NSLayoutConstraint] {
self.translatesAutoresizingMaskIntoConstraints = false
var constraints = [NSLayoutConstraint]()
if let superview = self.superview {
constraints.append(self.constraining(.leading, .equal, to: superview, constant: edgeInsets.left, priority: priority))
constraints.append(self.constraining(.trailing, .equal, to: superview, constant: -edgeInsets.right, priority: priority))
constraints.append(self.constraining(.top, .equal, to: superview, constant: edgeInsets.top, priority: priority))
constraints.append(self.constraining(.bottom, .equal, to: superview, constant: -edgeInsets.bottom, priority: priority))
}
@michaelochs
michaelochs / LocalNotifications.m
Last active August 29, 2015 14:23
Short snipped with an explanation of how your app needs to respond to local notifications.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UILocalNotification *localNotification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotification) {
// the user opened your app by tapping either the notification banner, the notification
// center entry or the open action in the alert view of the notification while your app
// was not running / suspended.
// This is where you want to react to the user's action!
}
}
import Foundation
import Quartz
extension Array {
func each(doThis: (element: T) -> Void) {
for e in self {
doThis(element: e)
}
}
}
@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
@skhaz
skhaz / main.cpp
Last active April 9, 2021 12:23
Steganography
#include <QtDebug>
#include <QImage>
#include <QString>
#include <QBitArray>
#include <QByteArray>
#include <QFile>
#include <QCommandLineParser>
namespace {
enum { headerSize = 32 };