Skip to content

Instantly share code, notes, and snippets.

@hweetty
hweetty / safari_pip
Created May 26, 2017 04:44
Picture-in-picture on youtube bookmarklet
javascript:(function(){document.getElementsByClassName("html5-main-video")[0].webkitSetPresentationMode("picture-in-picture");})();
@hweetty
hweetty / pre-commit
Last active March 28, 2017 15:30 — forked from kuy/pre-commit
git pre-commit hook script
#!/bin/sh
matches=$(git diff --cached | grep -iE '\+.*?FIXME')
if [ "$matches" != "" ]; then
echo "Must not commit 'FIXME' code"
echo " ${matches}"
exit 1
fi
branch_prefix=$(git rev-parse --abbrev-ref HEAD | egrep "^(feature|bugfix)\/")
@hweetty
hweetty / ATS Disable
Created November 21, 2015 17:27 — forked from rounak/ATS Disable
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@hweetty
hweetty / url_regex.txt
Last active August 29, 2015 14:13
Regex for URL (Objective-C)
(https?:\\/\\/)?([-a-zA-Z0-9.])+\\.(ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)([-0-9a-z./?=!@#$%^&*()-_+=',:])*
@hweetty
hweetty / snippet.m
Last active August 29, 2015 14:13
Show OS X emoji keyboard (simulates cmd+ctr+space)
// Make sure a textfield is focused before calling for optimal results
- (void)showEmojiKeyboard {
// http://stackoverflow.com/questions/10734349/simulate-keypress-for-system-wide-hotkeys
CGEventSourceRef src = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
CGEventRef spcd = CGEventCreateKeyboardEvent(src, 0x31, true);
CGEventRef spcu = CGEventCreateKeyboardEvent(src, 0x31, false);
CGEventSetFlags(spcd, kCGEventFlagMaskCommand | kCGEventFlagMaskControl);
CGEventSetFlags(spcu, kCGEventFlagMaskCommand | kCGEventFlagMaskControl);

Keybase proof

I hereby claim:

  • I am hweetty on github.
  • I am hweetty (https://keybase.io/hweetty) on keybase.
  • I have a public key whose fingerprint is 3E30 4451 B817 F431 5FF7 DF2C A50F 34CE 192C 897D

To claim this, I am signing this object: