Skip to content

Instantly share code, notes, and snippets.

View darknoon's full-sized avatar

Andrew Pouliot darknoon

View GitHub Profile
@darknoon
darknoon / ObjCClass.api.js
Created March 24, 2017 21:46
How to use ObjCClass library
const MyClass = new ObjCClass({
classname: 'MyClass',
superclass: NSButton,
_private: 'initial',
init() {
log("my custom init code. no need to call super here ");
this._private = 'test';
},
@darknoon
darknoon / flow.log
Created September 1, 2017 23:32
Flow errors
This file has been truncated, but you can view the full file.
Error: node_modules/apollo-client/node_modules/graphql-tag/node_modules/graphql/type/definition.js.flow:108
108: GraphQLList<GraphQLOutputType>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ GraphQLList. This type is incompatible with
1196: export class GraphQLNonNull<T: GraphQLNullableType> {
^^^^^^^^^^^^^^^^^^^ union: GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | GraphQLEnumType | GraphQLInputObjectType | type application of class `GraphQLList`
Member 1:
203: GraphQLScalarType |
^^^^^^^^^^^^^^^^^ GraphQLScalarType
Error:
108: GraphQLList<GraphQLOutputType>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Unpacking OpenEXR-2.3.0
-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
@darknoon
darknoon / error_log.txt
Created April 25, 2019 19:30
Error attempting to install python.js
~/Developer/ML/js-ecosystem/modules/test-pythonjs (master #) $ yarn add python.js
yarn add v1.15.2
info No lockfile found.
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
error /Users/andrew/Developer/ML/js-ecosystem/modules/test-pythonjs/node_modules/python.js: Command failed.
Exit code: 1
Command: node-gyp rebuild
@darknoon
darknoon / SwiftUIEnum.swift
Created June 12, 2019 22:43
How to create a View that renders different content based on enum cases in Swift UI
enum Block {
case h(title: String)
case p(body: String)
}
extension View {
func erased() -> AnyView {
return AnyView(self)
}
}
@darknoon
darknoon / figma-default-layers.json
Last active October 25, 2019 04:07
Default values for the different layer types in the Figma plugin API
{
"RECTANGLE": {
"type": "RECTANGLE",
"name": "Rectangle",
"visible": true,
"locked": false,
"opacity": 1,
"blendMode": "PASS_THROUGH",
"isMask": false,
"effects": [],
@darknoon
darknoon / now.json
Last active October 30, 2019 16:33
How to make Private GH packages work with now and yarn
{
"build": {
"env": {
"MY_GH_TOKEN": "@my_gh_packages_access_token",
"NPM_RC": "registry=https://npm.pkg.github.com/<USERNAME or ORG>\n//npm.pkg.github.com/:_authToken=${MY_GH_TOKEN}\n//npm.pkg.github.com/<USERNAME or ORG>/:_authToken=${MY_GH_TOKEN}\nalways-auth=true\n"
}
},
}
@darknoon
darknoon / getHost.ts
Created November 5, 2019 21:46
A simple way to get the right host to query your API in serverless next.js
const getHost = (context: NextPageContext): { host: string; proto: string } => {
const { req } = context;
if (req !== undefined) {
const {
"x-forwarded-host": host,
"x-forwarded-proto": proto
} = req.headers;
if (
typeof host === "string" &&
typeof proto === "string" &&
@darknoon
darknoon / sign_s3_url.sql
Last active March 30, 2022 16:37
A function that lets you sign S3 urls for viewing from within your database queries
-- This function is based on this description:
-- https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html
CREATE OR REPLACE FUNCTION
sign_s3_url(
m_host text,
m_verb text,
m_resource text,
m_region text,
m_key text,