Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Pouliot darknoon

View GitHub Profile
View LocklessQueue.swift
//
// LocklessQueue.swift
// Famera
//
// Created by Andrew Pouliot on 11/11/20.
// Copyright © 2020 Famera. All rights reserved.
//
import Foundation
import CoreMedia
@darknoon
darknoon / sign_s3_url.sql
Created Dec 16, 2019
A function that lets you sign S3 urls for viewing from within your database queries
View sign_s3_url.sql
-- 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_resource text,
m_region text,
m_key text,
m_secret text,
@darknoon
darknoon / getHost.ts
Created Nov 5, 2019
A simple way to get the right host to query your API in serverless next.js
View getHost.ts
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 / now.json
Last active Oct 30, 2019
How to make Private GH packages work with now and yarn
View now.json
{
"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 / figma-default-layers.json
Last active Oct 25, 2019
Default values for the different layer types in the Figma plugin API
View figma-default-layers.json
{
"RECTANGLE": {
"type": "RECTANGLE",
"name": "Rectangle",
"visible": true,
"locked": false,
"opacity": 1,
"blendMode": "PASS_THROUGH",
"isMask": false,
"effects": [],
@darknoon
darknoon / SwiftUIEnum.swift
Created Jun 12, 2019
How to create a View that renders different content based on enum cases in Swift UI
View SwiftUIEnum.swift
enum Block {
case h(title: String)
case p(body: String)
}
extension View {
func erased() -> AnyView {
return AnyView(self)
}
}
@darknoon
darknoon / error_log.txt
Created Apr 25, 2019
Error attempting to install python.js
View error_log.txt
~/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
View gist:e5109f74f109a3f854a8a8e1eb495610
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++
View Process Image.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View flow.log
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: