Skip to content

Instantly share code, notes, and snippets.

View atomkirk's full-sized avatar

Adam Kirk atomkirk

View GitHub Profile
@atomkirk
atomkirk / rob-git-cheatsheet.md
Last active August 29, 2015 14:02
rob git cheatsheet

Cloning

  • git clone --recursive <repo> <the-name-you-want-for-repo-directory>

Set up production remote

  • git remote add production <production-repo-url>

Updating

  • git add . -A
  • git commit -am 'message'
  • git pull -r origin master

###Endpoint:

POST /companies/:company_token/interactions

JSON:

{ "interaction":
  {
    "channel": "chat",

"body": "blah",

@atomkirk
atomkirk / favorite_git.md
Last active August 29, 2015 13:56
My Favorite Git Commands

Git with your host, Adam Kirk

Introduction

I do not claim to be smart at all, but I've worked with very smart people and they have taught me about git and how it works at a fundamental level, so I feel at this point qualified to offer some of the stuff I've learned as best practices. So her'goes.

Fetch All

When you pull, you sometimes don't know what you're pulling. It can be helpful to use git fetch --all and compare what's on your remotes with git diff origin/master to see what's different.

more to come…

@atomkirk
atomkirk / subl3_cmd_mode_autocomplete.md
Created January 1, 2014 21:46
Exit Autocomplete and enter command mode sublime text 3

In sublime 3, the new command for exiting_insert_mode (for Vintageous used in Sublime Text 3 vs Vintage used in 2) is vi_enter_normal_mode

Create a plugin:

	import sublime, sublime_plugin
	
	class ExitAutoCompleteAndInsertModeCommand(sublime_plugin.TextCommand):
	  def run(self, edit):

self.view.run_command("hide_auto_complete")

@atomkirk
atomkirk / publish_using_git.md
Last active December 31, 2015 21:09
Publishing Using Git

You've got files in a git repo and you want them on a static server. Here's how it's done using a Mac Mini:

  1. Set up your local repo

     $ mkdir marketing && cd marketing
     $ git init
     $ echo 'Hello, world!' > index.html
     $ git add .
     $ git commit -am "init"
    
- (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSCompositingOperation)op fraction:(CGFloat)alpha {
[self drawInRect:dstRect fromRect:srcRect operation:op fraction:alpha respectFlipped:YES hints:nil];
}
- (void)drawInRect:(NSRect)dstRect fromRect:(NSRect)srcRect operation:(NSCompositingOperation)op fraction:(CGFloat)alpha respectFlipped:(BOOL)respectFlipped hints:(NSDictionary *)hints {
CGImageRef image = [self CGImageForProposedRect:&dstRect context:[NSGraphicsContext currentContext] hints:hints];
if (image == NULL) {
NSLog(@"*** Could not get CGImage of %@", self);
return;
}
@atomkirk
atomkirk / interationalization_testing.md
Created October 22, 2013 14:37
Internationalization testing

Some developers still don’t know you should paste “Iñtërnâtiônàlizætiøn” everywhere while testing,

@atomkirk
atomkirk / find where a view was added.md
Last active December 25, 2015 16:49
Find where a view was added. (Cocoa)

Sometimes, a view will appear on your screen and you don't know how it got there. Did your app add it? Did the SDK add it? Here's how to get the debugger to stop right where it was added so you can look at the call stack.

First, set up a symbolic breakpoint on [UIView addSubview:]

![](http://d1zjcuqflbd5k.cloudfront.net/files/acc_52627/wVZ0?response-content-disposition=inline;%20filename=Screen%20Shot%202013-10-16%20at%2008.14.48.png;%20filename*=UTF-8%27%27Screen%20Shot%202013-10-16%20at%2008.14.48.png&amp;Expires=1381933199&amp;Signature=JGq~PuVw4twJDbkwbd

@atomkirk
atomkirk / empty image.m
Created October 2, 2013 17:12
Sometimes you just need an empty image...
// Create hidden image since we can't hide/set nil the image for the search field
UIGraphicsBeginImageContext(self.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
CGContextFillRect(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height));
UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();