Skip to content

Instantly share code, notes, and snippets.

View evadne's full-sized avatar
🎣
gone fishing

Evadne Wu evadne

🎣
gone fishing
View GitHub Profile
@evadne
evadne / gist:5596987
Created May 17, 2013 04:49
Correctly Handling ACErrorAccountNotFound
ACAccountStore * const accountStore = [ACAccountStore new];
ACAccountType * const accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[accountStore requestAccessToAccountsWithType:accountType options:@{
ACFacebookAppIdKey: @"-snip-"
} completion:^(BOOL granted, NSError *error) {
if (!granted) {
switch (error.code) {
case ACErrorAccountNotFound: {
dispatch_async(dispatch_get_main_queue(), ^{
@evadne
evadne / index.html
Created May 8, 2013 01:58
According (Single Visible Flex Stack)
<html>
<head>
<meta charset="UTF-8">
<title>Accordion Test</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
body {
@evadne
evadne / index.html
Created May 7, 2013 22:52
Accordion (Stacked Flex-Box Panels)
<html>
<head>
<meta charset="UTF-8">
<title>Accordion Test</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
body {
@evadne
evadne / index.html
Last active December 17, 2015 01:58
Accordion
<html>
<head>
<meta charset="UTF-8">
<title>Accordion Test</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
body {
@evadne
evadne / gist:5519337
Last active May 17, 2016 09:05
Loading Custom Fonts with CTFontManager
CTFontManagerRegisterFontsForURLs((__bridge CFArrayRef)((^{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *resourceURL = [[NSBundle mainBundle] resourceURL];
NSArray *resourceURLs = [fileManager contentsOfDirectoryAtURL:resourceURL includingPropertiesForKeys:nil options:0 error:nil];
return [resourceURLs filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSURL *url, NSDictionary *bindings) {
CFStringRef pathExtension = (__bridge CFStringRef)[url pathExtension];
NSArray *allIdentifiers = (__bridge_transfer NSArray *)UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, pathExtension, CFSTR("public.font"));
if (![allIdentifiers count]) {
return NO;
}
@evadne
evadne / index.html
Created May 4, 2013 21:26
Sticky HTML Header
<html>
<head>
<meta charset="utf=8">
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
body {
max-width: 1024px;
@evadne
evadne / gist:5485195
Created April 29, 2013 22:08
Create display override file to force Mac OS X to use RGB mode for Display
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -r -c AppleDisplay`
edid_hex=data.match(/IODisplayEDID.*?<([a-z0-9]+)>/i)[1]
vendorid=data.match(/DisplayVendorID.*?([0-9]+)/i)[1].to_i
@evadne
evadne / gist:5457783
Created April 25, 2013 05:53
Dump Polygons from the Geometry Control sample from Google (with v2 JavaScript API)
// use on the geometry control
function getVertices (polygon) {
var answer = [];
for (var i = 0, I = polygon.getVertexCount(); i < I; ++i) {
var xy = polygon.getVertex(i);
answer.push([xy.lat(), xy.lng()]);
}
return answer;
}
@evadne
evadne / gist:5385806
Created April 15, 2013 04:52
Loading images from Data URIs
// Image is from http://dopiaza.org/tools/datauri/examples/index.php
#import "DIAppDelegate.h"
@implementation DIAppDelegate
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
@evadne
evadne / README.md
Last active December 15, 2015 17:39
Patch your mogenerator to evadne/mogenerator/develop

Uninstall mogenerator builds

$ brew uninstall mogenerator
Uninstalling /usr/local/Cellar/mogenerator/HEAD...

Install the custom mogenerator build

$ brew install --HEAD https://gist.github.com/evadne/5298379/raw/0faa5ade1fee735bbeae7b88872ab2f458151abc/mogenerator.rb
######################################################################## 100.0%
==&gt; Cloning https://github.com/evadne/mogenerator.git