Skip to content

Instantly share code, notes, and snippets.

@alloy
alloy / README.markdown
Created November 3, 2014 15:17
Fix Apple’s broken 10.9.0-10.9.2 default Ruby gems installation.

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 / ios-release-hockey-app.rake
Created January 30, 2012 18:06
Rake tasks to create an iOS app archive and push dSYM to HockeyApp.
module Gem; end
require 'rubygems/version'
namespace :version do
module InfoPlist
extend self
def [](key)
output = `/usr/libexec/PlistBuddy -c 'Print #{key}' Bananas-Info.plist`.strip
@alloy
alloy / README.markdown
Created August 8, 2014 09:56
Learn the LLVM C++ API by example.

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 / DEA-providers.rb
Created May 24, 2012 09:47
List of ‘disposable email address’-provider hostnames. Collected from http://bit.ly/Jt6FZU & http://bit.ly/JKNcYC.
[".e4ward.com",
".mailexpire.com",
".otherinbox.com",
"0815.ru",
"0clickemail.com",
"0wnd.net",
"0wnd.org",
"10minutemail.com",
"20minutemail.com",
"2prong.com",
@alloy
alloy / 1-input.ts
Last active March 27, 2024 08:18
Why does TypeScript inline the typeof type?
const x = {
foo: "bar",
answer: 42
}
type X = typeof x
export default {
get X(): X {
return x
diff --git a/node_modules/relay-runtime/lib/store/RelayResponseNormalizer.js b/node_modules/relay-runtime/lib/store/RelayResponseNormalizer.js
index b9994b3..e970570 100644
--- a/node_modules/relay-runtime/lib/store/RelayResponseNormalizer.js
+++ b/node_modules/relay-runtime/lib/store/RelayResponseNormalizer.js
@@ -351,6 +351,7 @@ var RelayResponseNormalizer = /*#__PURE__*/function () {
if (process.env.NODE_ENV !== "production") {
process.env.NODE_ENV !== "production" ? warning(typeof isDeferred === 'boolean', 'RelayResponseNormalizer: Expected value for @defer `if` argument to ' + 'be a boolean, got `%s`.', isDeferred) : void 0;
+ invariant(defer.selections[0].kind === "InlineFragment" && defer.selections[0].selections.length > 0, "RelayResponseNormalizer: Expected @defer on InlineFragment with selections");
}
@alloy
alloy / stderr.txt
Last active July 5, 2023 16:52
v0.62.0-rc.3 CHANGELOG
~/C/R/r/releases [changelog-fixes] » yarn generate -b v0.61.5 -c v0.62.0-rc.3 -r ../../react-native -f ./CHANGELOG.md -t [GITHUB-TOKEN]
Resolve base commit
https://github.com/facebook/react-native/commit/bb625e523867d3b8391a76e5aa7c22c081036835
Fetch commit data
https://api.github.com/repos/facebook/react-native/commits?sha=v0.62.0-rc.3&page=1
https://api.github.com/repos/facebook/react-native/commits?sha=v0.62.0-rc.3&page=2
https://api.github.com/repos/facebook/react-native/commits?sha=v0.62.0-rc.3&page=3
https://api.github.com/repos/facebook/react-native/commits?sha=v0.62.0-rc.3&page=4
https://api.github.com/repos/facebook/react-native/commits?sha=v0.62.0-rc.3&page=5
@alloy
alloy / 1 - Find issue view
Last active June 2, 2023 10:01
Finding the Xcode issues navigator
~/C/A/eigen [master] » lldb -p (pgrep '^Xcode$')
(lldb) process attach --pid 34726
Process 34726 stopped
Executable module set to "/Applications/Xcode-Beta.app/Contents/MacOS/Xcode".
Architecture set to: x86_64-apple-macosx.
(lldb) po [[NSApplication sharedApplication] windows]
<__NSArrayM 0x7fe18be755d0>(
<IDEWorkspaceWindow: 0x7fe18045ba40>,
<_NSFullScreenUnbufferedWindow: 0x7fe1841b18d0>,
<_NSFullScreenTransitionOverlayWindow: 0x7fe1841b3770>,
@alloy
alloy / README.md
Last active July 6, 2022 14:45
Benchmark various GraphQL resolving variants

Benchmark various GraphQL resolving variants

There exists confusion about how a GraphQL execution engine like graphql-js does its work. The engine will invoke a resolve function for every [scalar] field in a request.

  • defaultFieldResolver: By default graphql-js will invoke its own defaultFieldResolver resolve function when no explicit resolver was specified when generating the executable schema. This resolver needs to do some reflection on the request in order to determine what data to return.
  • explicitDefaultFieldResolver: We can also use graphql-js's defaultFieldResolver explicitly, which will skip a check for whether or not a field resolver function was specified when generating the executable schema.
  • customFieldResolver: We can also specify our own field resolver function that does not need to perform any reflection, as we know what type to return.
  • customAsyncFieldResolver: Custom field resolvers can also be async. This doesn't make their own execution time much worse, but scheduli

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,