Skip to content

Instantly share code, notes, and snippets.

View jakemarsh's full-sized avatar

Jake Marsh jakemarsh

View GitHub Profile

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@chocnut
chocnut / Gemfile
Last active December 11, 2016 19:49
iOS AC + Social(Facebook) Framework & Rails(omniauth-facebook)
gem 'devise'
gem 'omniauth-facebook'
// LXTouchGestureRecognizer.h
//
// Copyright (c) 2015 Stan Chang Khin Boon (http://lxcid.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
import Darwin
extension Int {
static func random() -> Int {
return Int(arc4random())
}
static func random(range: Range<Int>) -> Int {
return Int(arc4random_uniform(UInt32(range.endIndex - range.startIndex))) + range.startIndex
}
@mattt
mattt / nshipster-new-years-2015.md
Created November 25, 2014 19:38
NSHipster New Year's 2015

Season's Greetings, NSHipsters!

As the year winds down, and we take a moment to reflect on our experiences over the past months, one thing is clear: 2014 has been an incredible year professionally for Apple developers. So much has happened in such a short timespan, and yet it's hard to remember our relationship to Objective-C before Swift, or what APIs could have captivated our imagination as much as iOS 8 or WatchKit.

It's an NSHipster tradition to ask you, dear readers, to send in your favorite tips and tricks from the past year for publication over the New Year's holiday. This year, with the deluge of new developments—both from Cupertino and the community at large—there should be no shortage of interesting tidbits to share.

Submit your favorite piece of Swift or Objective-C trivia, framework arcana, hidden Xcode feature, or anything else you think is cool, and you could have it featured in the year-end blowout article. Just comment on this gist below!

If you're wondering about what to post, look to

@chockenberry
chockenberry / gist:055bd31f28f3bc5904ea
Last active October 22, 2020 19:24
LAST TIME I WAS IN A PLAY GROUND I GOT BUSTED
typealias BOOLAEN = Bool
typealias LIKEON68K = UInt16
typealias LIKEONPENTIUM = UInt32
typealias STRING = String
typealias STRINGINDEX = String.Index
typealias BOOL = Bool
typealias UNICODESCALER = UnicodeScalar
typealias GONADS = String
typealias NUMBERSWITHDOTS = Double
import KeychainAPI
let keychain: Keychain = Keychain(service: "com.secondgear.myapp", accessibility: Accessibility.WhenUnlocked)
let userAccount = Account(userName: "justinw@me.com", secret: "lovesecretsexgod")
keychain.add(userAccount)
let fetchedAccount:Account? = keychain.accountFor("justinw@me.com")
if (fetchedAccount != nil)
{
fetchedAccount?.secret = "newpassword"
@collindonnell
collindonnell / SafelyMessageTarget.m
Last active August 29, 2015 14:03
Notify a target with the specified arguments only if it responds to a selector.
- (void)safelyMessageTarget:(id)target withSelector:(SEL)selector arguments:(NSArray *)arguments {
if ([target respondsToSelector:selector]) {
NSMethodSignature *methodSignature = [NSMethodSignature methodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
[arguments enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[invocation setArgument:(__bridge void *)(obj) atIndex:idx];
}];
[invocation invokeWithTarget:target];
@calebd
calebd / AsynchronousOperation.swift
Last active April 29, 2023 13:12
Concurrent NSOperation in Swift
import Foundation
/// An abstract class that makes building simple asynchronous operations easy.
/// Subclasses must implement `execute()` to perform any work and call
/// `finish()` when they are done. All `NSOperation` work will be handled
/// automatically.
open class AsynchronousOperation: Operation {
// MARK: - Properties
@jpsim
jpsim / JAZMusician.h
Created July 7, 2014 09:25
SourceKit Playground
//
// JAZMusician.h
// JazzyApp
//
#import <Foundation/Foundation.h>
/**
JAZMusician models, you guessed it... Jazz Musicians!
From Ellington to Marsalis, this class has you covered.