Skip to content

Instantly share code, notes, and snippets.


Marc Chambers mchambers

View GitHub Profile
mchambers /
Created Mar 8, 2017
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);
View gist:5e930dd3878c89d50c9b
# Valid and working as of 04/21/2014
# Xcode 5.0.1, XCode Server
API_TOKEN="This can be found here:"
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"
mchambers / serializer.swift
Created Jun 25, 2014
A simple, limited model-to-JSON serializer in Swift.
View serializer.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 {
mchambers / reflect.swift
Last active Oct 19, 2020
Basic Reflection in Swift.
View reflect.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.
View Cocoapods

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"

View gist:4727994
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
View gist:4694773
#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"];
You can’t perform that action at this time.