Skip to content

Instantly share code, notes, and snippets.

@jcavar
jcavar / wish.c
Created Mar 25, 2021
A shell in C and Swift
View wish.c
#include <stdio.h>
#include <readline/readline.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
char *paths;
View gist:a30c23b42e98974740accfd49fe42318
*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
(
0 CoreFoundation 0x000000010d09db0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010cb02141 objc_exception_throw + 48
2 CoreFoundation 0x000000010cfb256d -[__NSPlaceholderArray initWithObjects:count:] + 269
3 CoreFoundation 0x000000010cfb92b4 +[NSArray arrayWithObjects:count:] + 52
4 XCTest 0x000000010c4fe4f7 -[XCElementSnapshot(Hitpoint) _transformPoint:windowContextID:windowDisplayID:] + 133
5 XCTest 0x000000010c4fe8e9 -[XCElementSnapshot(Hitpoint) hitPoint] + 386
6 WebDriverAgentLib 0x000000011e83a00a -[XCElementSnapshot(FBIsVisible) fb_isVisible] + 810
View gist:512d9820ceee90cf74437c865d323c54
2017-06-10 15:11:51:552 - info: [Xcode] = 13.91s Find: Elements matching predicate '"Accept" IN identifiers'
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Find: Element at index 0
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Use cached accessibility hierarchy for com.bundle.identifier
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Find: Descendants matching type Any
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Find: Elements matching predicate '"Accept" IN identifiers'
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Find: Element at index 0
2017-06-10 15:11:51:552 - info: [Xcode] t = 13.91s Use cached accessibility hierarchy for com.bundle.identifier
2017-06-10 15:11:51:553 - info: [Xcode] t = 13.91s Find: Descendants matching type Any
2017-06-10 15:11:51:553 - info: [Xcode] t = 13.92s Find: Elements matching predicate '"Accept" IN identifiers'
2017-06-10 15:11:51:553 - info: [Xcode]
View gist:3c1fea0e2730e25e0169
### Keybase proof
I hereby claim:
* I am jcavar on github.
* I am jcavar (https://keybase.io/jcavar) on keybase.
* I have a public key whose fingerprint is EBC7 C756 9125 1336 27CC 593C 1BBC EBC1 0499 EE18
To claim this, I am signing this object:
@jcavar
jcavar / VerticalText
Created Jun 28, 2014
Regex to insert \n after every character in string
View VerticalText
NSString *horizontalText = @"horizontal text";
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(.)" options:NSRegularExpressionCaseInsensitive error:nil];
NSString *verticalText = [regex stringByReplacingMatchesInString:horizontalText options:0 range:NSMakeRange(0, horizontalText.length) withTemplate:@"$1\n"];
@jcavar
jcavar / SideViewController.m
Created May 14, 2014
Preffered way to implement side controller when using ViewDeck(https://github.com/Inferis/ViewDeck)
View SideViewController.m
@interface SideViewController ()
@property (strong, nonatomic) IBOutlet UITableView *tableViewSide;
@property (strong, nonatomic) NSArray *options;
@end
@implementation SideViewController
#pragma mark - Object lifecycle
@jcavar
jcavar / TimeAgo
Created May 11, 2014
DateUtils getRelativeTimeSpanString method which cares about time zone
View TimeAgo
/**
* DateUtils getRelativeTimeSpanString methods which cares about time zone
* @param date date for which you want time ago
* @param timeZone time zone in which is date
* @return time ago string
*/
public static String timeAgoFromDate(Date date, TimeZone timeZone) {
TimeZone defaultTimeZone = TimeZone.getDefault();
TimeZone.setDefault(timeZone);