Skip to content

Instantly share code, notes, and snippets.

@gngrwzrd
gngrwzrd / prefs.txt
Created October 8, 2014 00:43
Sublime User Preferences with Phoenix Theme and Base16 Colors
{
"color_scheme": "Packages/Theme - Phoenix/Color Scheme/Tomorrow-Night.tmTheme",
"draw_indent_guides": false,
"fold_buttons": false,
"font_face": "Monaco",
"font_size": 15,
"ignored_packages":
[
"Vintage"
],
@gngrwzrd
gngrwzrd / fix-xcode.py
Last active December 23, 2015 11:28 — forked from rnapier/fix-xcode
#!/usr/bin/python
#original script by Rob Napier <robnapier@gmail.com>
#updates by github.com/gngrwzrd
#Script to link in all your old SDKs every time you upgrade Xcode
#Create a directory somewhere to store older SDKs in
#Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
#Under those, store the SDKs:
@gngrwzrd
gngrwzrd / keymap.c
Last active April 1, 2021 05:04
keymap.c
static uint8_t mode = 0;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if(keycode == 20737) { //fnc key.
if(record->event.pressed) {
rgb_matrix_set_color_all(110, 50, 100);
mode = rgb_matrix_get_mode();
rgb_matrix_mode_noeeprom(1);
} else {
rgb_matrix_mode(mode);
@gngrwzrd
gngrwzrd / allInputs.swift
Last active May 31, 2021 23:26
iOS Find All Inputs
private func allInputs(view:UIView) -> [UIView] {
var inputs:[UIView] = []
for view in view.subviews {
if view is UITextField || view is UITextView {
inputs.append(view)
}
let subInputs = _allInputs(view: view)
if subInputs.count > 0 {
inputs.append(contentsOf: subInputs)
}
inputs.sort { view1, view2 in
let view1Frame = view1.convert(CGPoint.zero, to: nil)
let view2Frame = view2.convert(CGPoint.zero, to: nil)
if view1Frame.y == view2Frame.y {
return view1Frame.x < view2Frame.x
}
return view1Frame.y < view2Frame.y
}
class FormFieldNavigator {
weak var view:UIView? {
didSet {
if let _ = view {
update()
} else {
inputs = []
}
}
extension Notification.Name {
///Post this to go next.
static let FormFieldNavigationNext = Notification.Name("FormFieldNavigationNext")
///Post this to go previous.
static let FormFieldNavigationPrevious = Notification.Name("FormFieldNavigationPrevious")
///Post this to end editing.
static let FormFieldNavigationDone = Notification.Name("FormFieldNavigationDone")
extension Notification.Name {
///Post this to go next.
static let FormFieldNavigationNext = Notification.Name("FormFieldNavigationNext")
///Post this to go previous.
static let FormFieldNavigationPrevious = Notification.Name("FormFieldNavigationPrevious")
///Post this to end editing.
static let FormFieldNavigationDone = Notification.Name("FormFieldNavigationDone")
#import <Foundation/Foundation.h>
@class PipedTaskRunner;
@protocol PipedTaskRunnerDelegate
@optional
- (void) taskRunner:(PipedTaskRunner *) taskRunner didReadData:(NSData *) data;
- (void) taskRunner:(PipedTaskRunner *) taskRunner didReadDataFromStdOut:(NSData *) data;
- (void) taskRunner:(PipedTaskRunner *) taskRunner didReadDataFromStdErr:(NSData *) data;
- (void) taskRunnerTerminated:(PipedTaskRunner *) taskRunner;
///Options that your UITextFieldDelegate or UITextViewDelegate can
///implement to provide some return key type options to the field navigator.
protocol FormFieldNavigationReturnKeyTypeOptions {
///Whether or not the field navigator can set return type.
var fieldNavigatorCanSetReturnKeyType:Bool { get set }
///The return key type that the field navigator should set.
var fieldNavigatorReturnKeyType:UIReturnKeyType? { get set }