Skip to content

Instantly share code, notes, and snippets.

View mchambers's full-sized avatar

Marc Chambers mchambers

View GitHub Profile
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
1. master> git pull origin master
2. master> git branch temp_branch
3. master> git checkout temp_branch
4. temp_branch> ...Do your stuff and commit...
5. temp_branch> git checkout master
6. master> git pull origin master
7. master> git checkout temp_branch
8. temp_branch> git rebase master
9. temp_branch> git checkout master
10. master> git merge temp_branch

Setting up a good cocoapods environment

Before you start

Make sure that you have the latest version of Xcode installed from the Mac App Store, and that you have the command line tools installed. To install the command line tools, open Xcode, click Xcode->Preferences->Downloads->Command Line Tools

Install brew if needed.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@mchambers
mchambers / reflect.swift
Last active March 5, 2021 09:20
Basic Reflection in Swift.
// Let's define a basic Swift class.
class Fruit {
var type=1
var name="Apple"
var delicious=true
}
// We can get at some info about an instance of an object using reflect(), which returns a Mirror.
reflect(Fruit()).count
reflect(Fruit())[1].0
@mchambers
mchambers / serializer.swift
Created June 25, 2014 07:49
A simple, limited model-to-JSON serializer in Swift.
// Here we'll use Swift's IDE-supporting reflect()
// function to build a basic JSON serializer.
// Per the fine engineers at WWDC, Swift's reflection support
// exists purely to support the IDE and the Playground. But
// we can have some fun with it anyway. ;)
class SerializerBase {
}
# Valid and working as of 04/21/2014
# Xcode 5.0.1, XCode Server
#
#Settings
API_TOKEN="This can be found here: https://rink.hockeyapp.net/manage/auth_tokens"
DISTRIBUTION_LISTS="This is a comma seperated list of tags found under App -> Users -> "
PROVISIONING_PROFILE="You will have to manually copy your profile to /Library/Server/Xcode/Data/ProvisioningProfiles/<profile>.mobileprovision"
#EXAMPLE:"/Library/Server/Xcode/Data/ProvisioningProfiles/DocLink_InHouse_2013.mobileprovision"
NOTIFY="1"
@mchambers
mchambers / Code.gs
Created March 8, 2017 20:47
App Script for retrieving the concurrent viewer count of a YouTube live stream by channel ID.
function doGet(e) {
var channelId=e.parameter["channelId"];
var results=YouTube.Search.list("snippet", {"channelId":channelId, "type":"video", "eventType":"live"})
if(results.items.length!=0) {
var broadcastResults=YouTube.Videos.list("liveStreamingDetails", {"id":results.items.pop().id.videoId});
var output={"concurrentViewers":broadcastResults.items.pop().liveStreamingDetails.concurrentViewers};
return ContentService.createTextOutput(JSON.stringify(output)).setMimeType(ContentService.MimeType.JSON);
}
}