Skip to content

Instantly share code, notes, and snippets.

View JonathanADaley's full-sized avatar

Jon Daley JonathanADaley

View GitHub Profile
@roguesleipnir
roguesleipnir / LassoAutoFillAction.jsx
Last active July 16, 2024 03:17
Auto-Fill Lasso Scripts for Photoshop.
try {
// If bounds are null then there is no selection.
// But null check fails? So use Try/Catch instead.
if (app.activeDocument.selection.bounds) {
// Check Shift Modifier
SHIFT = ScriptUI.environment.keyboardState.shiftKey;
CTRL = ScriptUI.environment.keyboardState.ctrlKey;
// Fill manually.
if (!(CTRL || SHIFT)) {
import Dispatch
/// Dispatch options for `forEach` loops
public enum ForEachClosureDispatch {
case sequential
case concurrent
}
extension Sequence {
/// Calls the given closure on each element in the sequence in the same order
@0xBEEB
0xBEEB / gitnamechange.sh
Created June 29, 2015 22:09
Goes through a git projects history and changes the name on commits. I needed this after changing my name, and coming out as transgender in order to have my name show up correctly to the public.
# Goes through a git projects history and changes the name on commits
# I needed this after changing my name, and coming out as transgender
# in order to have my name show up correctly to the public.
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_NAME" = "Existing Dead Name" ];
then
GIT_AUTHOR_NAME="Authentic Name";
GIT_AUTHOR_EMAIL="your@email.com";
git commit-tree "$@";
@beccadax
beccadax / gist:72f3fcc3274c0e5f12d7
Created June 25, 2015 02:16
Fully generic safe subscripting in Swift
extension CollectionType where Index: Comparable {
subscript (safe index: Index) -> Generator.Element? {
guard startIndex <= index && index < endIndex else {
return nil
}
return self[index]
}
}
@JadenGeller
JadenGeller / Init Bool With Int.swift
Created March 23, 2015 07:48
Cast Int to Bool in Swift
extension Bool {
init<T : IntegerType>(_ integer: T){
self.init(integer != 0)
}
}
// Now you can do this
let x = Bool(5) // true
let y = Bool(-1) // true
let z = Bool(0) // false
@hpique
hpique / iOS7-notifications.h
Last active January 29, 2018 14:19
List of all public notifications available in iOS 7.0 (or at least those whose constants are properly named).
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestCaseRun.h
SENTEST_EXPORT NSString * const SenTestCaseDidStartNotification;
SENTEST_EXPORT NSString * const SenTestCaseDidStopNotification;
SENTEST_EXPORT NSString * const SenTestCaseDidFailNotification;
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestDistributedNotifier.h
SENTEST_EXPORT NSString * const SenTestNotificationIdentifierKey;
// Developer/Library/Frameworks/SenTestingKit.framework/Headers/SenTestSuiteRun.h
SENTEST_EXPORT NSString * const SenTestSuiteDidStartNotification;