Skip to content

Instantly share code, notes, and snippets.

@jnjosh
jnjosh / EmojiTextField.swift
Created June 9, 2023 21:42
Quick UITextField » SwiftUI wrapper for textfield that forces emoji keyboard
import SwiftUI
// UIKit-based text field that forces emoji keyboard as input mode.
class UIEmojiTextField : UITextField {
override var textInputMode: UITextInputMode? {
return UITextInputMode.activeInputModes
.filter { $0.primaryLanguage == "emoji" }
.first
}
}
@jnjosh
jnjosh / jnjosh.zsh-theme
Created January 6, 2013 01:21
My slightly modified zsh shell
# prompt style and colors based on Steve Losh's Prose theme:
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
#
# vcs_info modifications from Bart Trojanowski's zsh prompt:
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
#
# git untracked files modification from Brian Carper:
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
function virtualenv_info {

Keybase proof

I hereby claim:

  • I am jnjosh on github.
  • I am jnjosh (https://keybase.io/jnjosh) on keybase.
  • I have a public key ASBonVU4HBox2F61fNe_kewxSiugPmfAUV_2kG0BeBkKfQo

To claim this, I am signing this object:

@jnjosh
jnjosh / JNJObserver.h
Last active March 23, 2017 20:49
Reading http://chris.eidhof.nl/post/63590250009/lightweight-key-value-observing I got curious about using an observer object for KVO. It is an interesting idea.
//
// JNJObserver.h
//
// Created by Josh Johnson on 10/10/13.
// Copyright (c) 2013 jnjosh.com. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^JNJObserverActionHandler)(id changingObject, id oldValue, id newValue);
@jnjosh
jnjosh / TWTHasselhoffImageProtocol.h
Created May 18, 2014 19:43
TWTHasselhoffImageProtocol
//
// TWTHasselhoffImageProtocol.h
// TestURLProtocol
//
// Created by Josh Johnson on 5/9/14.
// Copyright (c) 2014 Two Toasters, LLC. All rights reserved.
//
@import Foundation;
//
// NSMutableArray+TTAdditions.h
// tester
//
// Created by Joshua Johnson on 5/1/12.
// Copyright (c) 2012 Two Toasters, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@jnjosh
jnjosh / xcode_build_settings.rb
Last active December 30, 2015 13:39
Script that gets the path to your built product from an Xcode workspace no matter your build location (Derived Data or Legacy Build Directory)
#
# Usage:
#
# app_path = product_path :workspace => "MyProject.xcworkspace",
# :scheme => "MyProjectScheme",
# :configuration => "Debug",
# :sdk => "iphonesimulator"
#
# puts app_path //=> /Users/yourusername/Library/Developer/Xcode/DerivedData/MyProject-bltlcokzhdicjggqmcrwibpdgdcp/Build/Products/Debug-iphonesimulator/MyProject.app
#
@jnjosh
jnjosh / BothCommandKeysPressed.xml
Created April 2, 2013 17:09
## Remappings for KeyRemapForMacBook (while being in the Dvorak layout) - BothCommandKeysPressed.xml remaps the home row to [{()}] when BOTH command keys are pressed - RightCommandVimBindings.xml remaps HLJK to the arrow keys when ONLY the RIGHT command key is pressed
<?xml version="1.0"?>
<root>
<item>
<name>Alt keyboard with Command_L + Command_R</name>
<item>
<name>Rebind all keys when both command keys are pressed</name>
<identifier vk_config="true">notsave.smp_alt_keyboard</identifier>
<autogen>__KeyToKey__ KeyCode::A, KeyCode::MINUS</autogen> <!-- A to [ -->
<autogen>__KeyToKey__ KeyCode::SEMICOLON, KeyCode::EQUAL</autogen> <!-- S to ] -->
<autogen>__KeyToKey__ KeyCode::S, KeyCode::MINUS, ModifierFlag::SHIFT_L</autogen> <!-- O to { -->
@jnjosh
jnjosh / gist:5062277
Created March 1, 2013 03:28
List Fonts
for (NSString *family in [UIFont familyNames]) {
NSLog(@"Family: %@", family);
for (NSString *font in [UIFont fontNamesForFamilyName:family]) {
NSLog(@" => Font: %@", font);
}
}
@jnjosh
jnjosh / OmniFocus-QuickEntry.applescript
Created January 27, 2013 01:16
Applescript to show the OmniFocus Quick Entry
tell application "OmniFocus"
tell quick entry
open
make new inbox task
tell application "System Events" to keystroke tab
activate
end tell
end tell