Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile

In our application, we have a need to wrap Apollo Client, amongst other reasons we do this to pass default link context to operations. This works well for operations originating from the top-level APIs, but it doesn't for the subscribeToMore function that gets created by useQuery.

We could augment useQuery further and also wrap each subscribeToMore function object that's created, but it struck us that the relationship between the useQuery invocation and the created subscribeToMore function might actually imply that it should inherit the link context of the useQuery invocation. Below you can find a naive patch that does this.

// src/core/ObservableQuery.ts  

public subscribeToMore< 
      TSubscriptionData = TData, 
#import <Foundation/Foundation.h>
#import <libkern/OSAtomic.h>
@interface NSArray (ConcurrentMap)
- (NSArray*)semaphore_map:(id (^)(id))block;
- (NSArray*)serial_map:(id (^)(id))block;
- (NSArray*)spinlock_map:(id (^)(id))block;
- (NSArray*)direct_map:(id (^)(id))block;
@end
When he’s not sorting coloured LEDs, soldering DIY synthesisers,
or sharing/forcing his extensive hands-on ‘X design’/browser experience
knowledge with/on the twittersphere, he leads a small app consultancy
shop known for their continuous striving for doing things well.
Pod::Spec.new do |s|
s.name = "PLCrashReporter"
s.version = "1.2-rc2"
s.summary = "Reliable, open-source crash reporting for iOS and Mac OS X."
s.description = <<-DESC
Plausible CrashReporter provides an in-process crash reporting
framework for use on both iOS and Mac OS X, and powers many of
the crash reporting services available for iOS, including HockeyApp,
Atlassian JMC, Crittercism, and Flurry.
require 'rubygems'
require 'cocoapods-downloader'
require 'cocoapods-core'
require 'cocoapods'
@spec = Pod::Spec.new do |s|
s.name = "MSActiveConfig"
s.version = "1.0.1"
s.summary = "Remote configuration and A/B Testing framework for iOS."
s.homepage = "https://github.com/mindsnacks/MSActiveConfig"
Pod::Spec.new do |spec|
spec.name = 'DTLoupe'
spec.version = '1.3.0'
spec.platform = :ios, '4.3'
spec.license = 'COMMERCIAL'
spec.source = { :git => 'git@git.cocoanetics.com:parts/dtloupe.git', :tag => spec.version.to_s }
spec.source_files = 'Core/Source/*.{h,m}'
spec.frameworks = 'QuartzCore'
spec.requires_arc = true
spec.homepage = 'http://www.cocoanetics.com/parts/dtloupeview/'
#!/usr/bin/env ruby
require 'pathname'
code_files = ARGV
code_files.each do |file|
file = Pathname(file)
contents = file.read
contents.gsub!(/(^#import .*\n)+/) do |imports|
imports = imports.split("\n")
imports.map! do |import|
@alloy
alloy / gist:4267777
Created December 12, 2012 13:38 — forked from anonymous/gist:4267712
Define hookable API in module that’s included, this way other clients can include a module that overrides those hooks. Because including modules inserts the methods in the ancestor lookup chain (i.e. the power of Ruby), this allows the use of super etc.
module APIExposable
def expose_api(mod = nil, &block)
if mod.nil?
if block.nil?
raise "Either a module or a block that's used to create a module is required."
else
mod = Module.new(&block)
end
elsif mod && block
raise "Only a module *or* is required, not both."
@alloy
alloy / gist:4257313
Created December 11, 2012 09:32 — forked from steipete/gist:1501754
Use Xcode to automatically set git hash
git=`sh /etc/profile; which git`
version=`$git describe --tags --always`
count=`$git rev-list --all | wc -l`
touch InfoPlist.h
echo -e "#define GIT_VERSION $version\n#define GIT_COMMIT_COUNT $count" > InfoPlist.h
@alloy
alloy / gist:2786823
Created May 25, 2012 09:04 — forked from barttenbrinke/gist:2786800
NSDATA+Base64 wrapper UTF8 issue
class Base64
def self.encode64(string)
result = NSData.alloc.initWithData(string).base64EncodedString
result = result.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion:true)
NSString.alloc.initWithData(result, encoding:NSUTF8StringEncoding)
end
def self.decode64(string)
data = NSData.dataFromBase64String(string)
NSString.alloc.initWithData(data, encoding:NSUTF8StringEncoding)