Skip to content

Instantly share code, notes, and snippets.

View collinprice's full-sized avatar

Collin Price collinprice

View GitHub Profile
@collinprice
collinprice / gist:5995154
Created July 14, 2013 18:13
Add this to the beginning of a file to remove those pesky redefinition errors.
#pragma once
@collinprice
collinprice / gist:6021886
Created July 17, 2013 15:54
Got a UIButton inside a UIView and you can't press the button?
[btn setUserInteractionEnabled:YES];
@collinprice
collinprice / gist:6092141
Created July 26, 2013 20:51
Generic C++ Makefile that needs to include C sources.
CC = gcc
CXX = g++
CXXFLAGS = -c -Wall -Wextra -pedantic
CCFLAGS = -c
LDFLAGS = -lpthread
CPP_SRC = main.cpp
CPP_SRC_OBJS = $(CPP_SRC:.cpp=.o)
@collinprice
collinprice / gist:6108034
Created July 29, 2013 21:31
C string in C++
#define C_TEXT( text ) ((char*)std::string( text ).c_str())
@collinprice
collinprice / gist:6210253
Created August 12, 2013 11:59
Args to GDB
gdb --args ./main -i settings.cfg
@collinprice
collinprice / a.sh
Created August 25, 2013 22:50
GPSBabel download waypoints and tracks from Garmin device.
sudo gpsbabel -t -w -i garmin -f usb: -o gpx -F out.gpx
@collinprice
collinprice / gist:7390995
Created November 9, 2013 22:37
fedora 19 use
Need to install extensions:
dash to dock
topicons
Fix workspaces:
gsettings set org.gnome.shell.overrides workspaces-only-on-primary false
@collinprice
collinprice / youtube_channel_downloader.sh
Created February 19, 2014 20:29
YouTube Channel Downloader
CHANNEL=$1
if [ -z $CHANNEL ]; then
echo "Missing channel name parameter."
exit 0
fi
mkdir $CHANNEL
cd $CHANNEL
youtube-dl -ciw -o '%(upload_date)s - %(title)s.%(ext)s' ytuser:$CHANNEL
@collinprice
collinprice / gist:9196756
Created February 24, 2014 20:50
Objective-C Main Thread
dispatch_async(dispatch_get_main_queue(), ^{
[self doSomething];
});
@collinprice
collinprice / Helpers.php
Created March 10, 2014 19:04
Strip Keys from array.
<?php
class Helpers {
public static function stripKeys(array $myArray, array $keys) {
foreach ($myArray as $key => $value) {
if (in_array($key, $keys)) {
unset($myArray[$key]);