Skip to content

Instantly share code, notes, and snippets.

View atomkirk's full-sized avatar

Adam Kirk atomkirk

View GitHub Profile
@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…

###Endpoint:

POST /companies/:company_token/interactions

JSON:

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

"body": "blah",

@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

Keybase proof

I hereby claim:

  • I am atomkirk on github.
  • I am atomkirk (https://keybase.io/atomkirk) on keybase.
  • I have a public key whose fingerprint is 1C0B BAC4 856C 3A57 29B0 6A25 659B F134 DCD3 F86E

To claim this, I am signing this object:

@atomkirk
atomkirk / pre-commit_audit
Created December 8, 2014 15:36
Pre-commit to audit source for personal code/log statements.
echo "Checking host URL…"
e=$(egrep -r '^\s+?host:.*?localhost:3000.*?$' . 2>/dev/null)
if [ -n "$e" ]; then
echo "You need to change host to heroku."
exit 1
fi
@atomkirk
atomkirk / javascript-isEqual.js
Last active August 29, 2015 14:11
unordered javascript object isEqual
// compares two objects deeply ignoring array ordering.
isEqual = function(a, b) {
objectMap = function(obj) {
var map = [];
var queue = [{ key: '', value: obj }];
while (queue.length > 0) {
var current = queue.shift();
var key = current.key;
@atomkirk
atomkirk / main.c
Created January 22, 2015 03:51
Simple C Web Server
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
@atomkirk
atomkirk / PassInError.swift
Last active August 29, 2015 14:22
Pass In Error
// PassInError.swift
// Created by Adam Kirk on 6/6/15.
import Foundation
typealias PassInErrorBlock = (error: NSError) -> Void
class PassInError: NSObject {
dynamic var ref: NSError?
@atomkirk
atomkirk / kill!!!!.md
Created June 10, 2015 17:41
My favorite way to kill a process with a name

PID=$(ps aux | grep -e 'vagrant' | grep -v grep | awk '{print $2}') && kill -s 9 $PID 2> /dev/null