Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Garnham SquaredTiki

View GitHub Profile
View jarno.json
{
"response_type": "in_channel",
"text": "<https://www.youtube.com/watch?v=xvUOHCYH-0A>",
"unfurl_links": true,
"unfurl_media": true
}
View keybase.md

Keybase proof

I hereby claim:

  • I am squaredtiki on github.
  • I am jgarnham (https://keybase.io/jgarnham) on keybase.
  • I have a public key ASCqih_qIFsLZQtZM7cP47sKTAYNLsjPJPLuLcnWajgQKgo

To claim this, I am signing this object:

View sam.json
{
"response_type": "in_channel",
"text": "<https://www.youtube.com/watch?v=3bCM8n8KVyo>",
"unfurl_links": true,
"unfurl_media": true
}
View test.json
{
"text": "<https://www.youtube.com/watch?v=OuojbGVGIkQ>",
"unfurl_links": true,
"unfurl_media": true
}
View KIF.js
tester.tapViewWithAccessibilityLabel("Send Money")
tester.enterText("012345678", intoViewWithAccessibilityLabel: "Recipient name or phone number")
tester.tapViewWithAccessibilityLabel("Send money to 012345678")
View gist:1156604
@implementation NSApplication (PlayChanger)
- (void)PlayChanger_playpause {
NSLog(@"Play Changer's playpause called!");
}
@end
@implementation PlayChanger
+ (void)load
{
View UIColor from HTML RGB
- (UIColor *)colorFromRGBValue:(NSString *)rgb { // General format is 'rgb(red, green, blue)'
if ([rgb rangeOfString:@"rgb"].location == NSNotFound)
return nil;
NSMutableString *mutableCopy = [rgb mutableCopy];
[mutableCopy replaceCharactersInRange:NSMakeRange(0, 4) withString:@""];
[mutableCopy replaceCharactersInRange:NSMakeRange(mutableCopy.length-1, 1) withString:@""];
NSArray *components = [mutableCopy componentsSeparatedByString:@","];
int red = [[components objectAtIndex:0] intValue];
View gist:1082923
[NSGraphicsContext saveGraphicsState];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self bounds] cornerRadius:30];
[path addClip];
NSGradient* aGradient = [[[NSGradient alloc] initWithColorsAndLocations:
[NSColor colorWithDeviceRed:0.5569 green:0.5137 blue:0.4588 alpha:1.0000], 0.0,
[NSColor colorWithDeviceRed:0.5569 green:0.5137 blue:0.4588 alpha:1.0000], 1.0,
nil] autorelease];
[aGradient drawInBezierPath:path angle:90];
View gist:1069721
<html>
<body>
<div id="content" contenteditable="true" style="font-family: Helvetica;">This is out Rich Text Editing View </div>
</body>
</html>
View NSRegularExpression
NSString *myString = @"NSString Is A Test for NSRegularExpression";
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression
regularExpressionWithPattern:@"(NS|UI)+(\w+)"
options:NSRegularExpressionCaseInsensitive
error:&error];
[regex enumerateMatchesInString:myString options:0 range:NSMakeRange(0, [myString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
NSLog(@"Text Range %@", match.range);
NSLog(@"Text %@", [myString substringWithRange:match.range]);