Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Greenberg bsgreenb

  • San Francisco, CA
View GitHub Profile
@bsgreenb
bsgreenb / Grid.tsx
Created Jul 5, 2020
GlowyStuff Grid V1
View Grid.tsx
import React, { ReactNode } from "react";
import {
SpacerSizeProp,
spacerSizeBaseEm,
spacerSizeEm,
} from "../../styles/layout";
import {
DirectionProp,
JustifyProp,
AlignContentProp,
@bsgreenb
bsgreenb / storybook-gatsby.ts
Last active May 5, 2020
Setting up Storybook on Gatsby/Typescript
View storybook-gatsby.ts
// Pre-req step: gatsby-plugin-typescript, storybook cli installation per docs...
// Then, here's custom config to support Gatsby/Typescript..:
// .storybook/main.ts
export = {
stories: ["../src/ui/**/*.stories.ts", "../src/ui/**/*.stories.tsx"],
addons: [
"@storybook/preset-create-react-app",
"@storybook/addon-a11y",
"@storybook/addon-actions",
@bsgreenb
bsgreenb / output.bash
Created Dec 24, 2019
Maximum call stack Bug on Gatsby/Contentful
View output.bash
npm info using npm@6.13.4
npm info using node@v12.10.0
npm verb run-script [ 'predevbuild', 'devbuild', 'postdevbuild' ]
npm info lifecycle glowyshit@0.0.1~predevbuild: glowyshit@0.0.1
npm info lifecycle glowyshit@0.0.1~devbuild: glowyshit@0.0.1
> glowyshit@0.0.1 devbuild /Users/ben/sources/glowyshit
> GATSBY_ACTIVE_ENV=development gatsby build && gatsby serve
Environment detected as: development
View contentful-export-recq25x3mcro-staging-2019-10-30T15-18-14.json
{
"contentTypes": [
{
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "recq25x3mcro"
}
View graphqlTypes.ts
export type Maybe<T> = T | null;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string,
String: string,
Boolean: boolean,
Int: number,
Float: number,
/**
* A date string, such as 2007-12-03, compliant with the ISO 8601 standard for
View schema.graphql
"""Provides default value for input field."""
directive @default(value: JSON!) on INPUT_FIELD_DEFINITION
"""Add date formating options."""
directive @dateformat(formatString: String, locale: String, fromNow: Boolean, difference: String) on FIELD_DEFINITION
"""Link to node by foreign-key relation."""
directive @link(by: String! = "id", from: String, on: String) on FIELD_DEFINITION
"""Link to File node by relative path."""
View asana_syncer.rb
# For the actual business logic around syncing new events to asana
# TODO: optimize asana api calls
# TODO: replace logs with logger. per https://guides.rubyonrails.org/debugging_rails_applications.html
class Syncer
def initialize
@asana = AsanaAPI.new
@tag_parser = TagParser.new
end
def sync_projects
View application_controller.rb
def generic_render(path, flash_hash = {})
flash_hash.each do |k, v|
flash.now[k] = v
end
if xhr?
@modal_path = path
render 'shared/modal_replace'
else
render path
View gist:8019637
agent.pre_connect_hooks << Proc.new do |agent, request|
puts { :method => request.method, :path => request.path, :headers => request.to_hash, :post_params => request.body }
end
agent.post_connect_hooks << Proc.new do |agent, uri, response, body|
puts { :status_code => response.code, :response_headers => response.to_hash, :mechanize_response_body => body, :mechanize_uri => uri}
end
View gist:7887936
Error in processing of request from 192.168.1.26:40407
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/netlib/tcp.py", line 375, in request_thread
self.handle_connection(request, client_address)
File "/Library/Python/2.7/site-packages/libmproxy/proxy.py", line 509, in handle_connection
h.handle()
File "/Library/Python/2.7/site-packages/libmproxy/proxy.py", line 177, in handle
while self.handle_request(cc) and not cc.close:
File "/Library/Python/2.7/site-packages/libmproxy/proxy.py", line 193, in handle_request
request = self.read_request(cc)