Skip to content

Instantly share code, notes, and snippets.

Avatar

Eloy Durán alloy

View GitHub Profile
@alloy
alloy / LiveQueryPolyfill.ts
Last active Oct 21, 2020
Rewrite GraphQL Live Query to subscription.
View LiveQueryPolyfill.ts
/**
* This is a Live Query polyfill, as graphql-js does not strictly have support for that. Instead, we leave it up to the
* client to recognize a Live Query is requested with the `@live` directive on a `query` operation and here we
* transform it into a `live` subscription instead.
*
* Consider a schema like the following:
*
* ```graphql
type Badge {
id: ID!
@alloy
alloy / README.markdown
Created Nov 3, 2014
Fix Apple’s broken 10.9.0-10.9.2 default Ruby gems installation.
View README.markdown

On Mac OS X 10.9.0 through 10.9.2, Apple shipped a Ruby and RubyGems installation that was missing specifications for the libraries that are included with Ruby by default, which leads to the user having to install a gem like the JSON gem even though the user already has that library installed.

(This is even more problematic if you want users to be able to install gems without having to have a properly configured compiler toolchain. I.e. where you do not want users to have to install gems with C extensions, such as the JSON gem.)

This was fixed starting from Mac OS X 10.9.3.

What it should look like

The following libraries are installed by default and should have their specifications installed:

@alloy
alloy / README.markdown
Created Aug 8, 2014
Learn the LLVM C++ API by example.
View README.markdown

The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c sample by using LLVM:

$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp
@alloy
alloy / gist:4952606
Last active Aug 19, 2020
Upload iOS application for clients on their iTunes Connect account.
View gist:4952606

Obviously, the simplest solution would be for the client to share their account details or add us as ‘team admin’, but that is not what this is about.

On https://developer.apple.com

  1. [Add us to your iOS Developer Program as ‘team member’.][1]
  2. [Create a ‘Distribution Certificate’, if you haven’t got one already.][2]
  3. [Create a ‘App Store Distribution Provisioning Profile’.][3]
  4. [Export the ‘Distribution Certificate’ assets and send the export and password to us.][4] (For security sake, it’s a good idea to send us the password via other means than the exported certificate. E.g. by phone/SMS.)

On https://itunesconnect.apple.com

@alloy
alloy / gist:5460654
Last active Jul 18, 2020
UICollectionViewFlowLayout subclass to vertically align cells at the bottom edge.
View gist:5460654
@interface MTLibraryCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
View remote-debugging-of-node-process-on-heroku.md

First grep the heroku logs for the message that will state that the debugger service has started:

$ heroku logs -t --app=[APP_ID] | grep 'Debugger listening on'

Then in another shell enable the debugger service of the Node process by connecting through SSH and sending the process SIGUSR1:

$ heroku ps:exec --app=[APP_ID]
View 1 - schema.graphql
scalar Date
type Query {
badge: Badge!
}
type Badge {
key: BadgeKey!
text: String!
history: BadgeHistoryConnection!
View glob.json
[
"Apps/Artist/ArtistApp.tsx",
"Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionEntity.tsx",
"Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionsRail.tsx",
"Apps/Artist/Components/ArtistCollectionsRail/__tests__/ArtistCollectionEntity.test.tsx",
"Apps/Artist/Components/ArtistCollectionsRail/__tests__/ArtistCollectionsRail.test.tsx",
"Apps/Artist/Components/ArtistCollectionsRail/index.tsx",
"Apps/Artist/Components/ArtistConsignButton.tsx",
"Apps/Artist/Components/ArtistHeader.tsx",
"Apps/Artist/Components/ArtistIndicator.tsx",
@alloy
alloy / build-settings.rb
Created Apr 28, 2020
Example of ways to introspect Xcode build settings
View build-settings.rb
# gem install xcodeproj claide hashdiff
require 'xcodeproj'
require 'claide'
require 'pp'
argv = CLAide::ARGV.new(ARGV)
project_path = argv.shift_argument
target_name = argv.option("target")
target_type = argv.option("target-type", "PBXNativeTarget")
View dump-target-build-settings.rb
require 'xcodeproj'
require 'pp'
unless (project_path = ARGV[0]) && (target_name = ARGV[1])
raise "Usage: ruby #{__FILE__} path/to/the.xcodeproj target-name [diff-base-config]"
end
project = Xcodeproj::Project.open(project_path)
target = project.targets.find { |t| t.name == target_name }
You can’t perform that action at this time.