Skip to content

Instantly share code, notes, and snippets.

@jazzychad
jazzychad / gist:0d730446502902ad3597
Created April 29, 2014 22:51
PS1 w/ git branch
[\h \[\033[0;36m\]\W\[\033[0m\]$(__git_ps1 " \[\033[1;32m\](%s)\[\033[0m\]")]\$

Keybase proof

I hereby claim:

  • I am jazzychad on github.
  • I am jazzychad (https://keybase.io/jazzychad) on keybase.
  • I have a public key whose fingerprint is 985B C9D2 1466 2E73 C27D 9792 4D0C FB63 C09D 814E

To claim this, I am signing this object:

@jazzychad
jazzychad / gist:1aef114dcc0a67592630
Created June 18, 2014 07:10
slingshot post data
{
"data": {
"caption": "Sniffing traffic",
"captionYPosition": 0.8010632,
"capturedAt": {
@jazzychad
jazzychad / mainqueue.c
Created July 29, 2014 23:21
mainqueue.c
// in some .h file
extern void runOnMainQueue(dispatch_block_t block);
extern void asyncRunOnMainQueue(dispatch_block_t block);
// in some .m file
void runOnMainQueue(dispatch_block_t block)
{
@jazzychad
jazzychad / notes.sh
Last active August 29, 2015 14:04
user input prompt
# if you want to capture some kind of user input during a script (e.g. Xcode Run Script Phase) you can use this neato trick
#
# it will give up after 20 seconds of no input and return an empty string, in the case you you hit Build and just walk away
#
# note: only works on macs b/c it uses AppleScript
echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')
# e.g.
BUILD_NOTES=`echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')`
@jazzychad
jazzychad / metadata.json
Created August 2, 2014 18:36
Hello World
{
"title": "Hello World",
"visbility": "public",
"visibility": "public"
}
{
"title": "Second!",
"visbility": "public",
"visibility": "public"
}
@jazzychad
jazzychad / metadata.json
Created August 3, 2014 18:35
This is a Post
{
"title": "This is a Post",
"visbility": "public",
"visibility": "public"
}
@jazzychad
jazzychad / propertynotif_snippet.m
Last active August 29, 2015 14:05
Set property with notification observation
- (void)set<#Property#>:(<#class#> *)<#parameter#>
{
if (<#ivar#> != <#parameter#>) {
if (<#ivar#>) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:<#(NSString *)#> object:<#(ivar)#>];
}
<#ivar#> = <#parameter#>;
if (<#ivar#>) {
@jazzychad
jazzychad / uiview_snippet.m
Created August 12, 2014 20:22
Snippet for UIViews which visually represent an object
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)layoutSubviews
{
[super layoutSubviews];
}