Skip to content

Instantly share code, notes, and snippets.

Avatar

Trey Griffith treygriffith

View GitHub Profile
@treygriffith
treygriffith / hubspot_contact_selectors.json
Created Oct 27, 2021
HubSpot contacts rendered selectors
View hubspot_contact_selectors.json
{
"selectors": [
{
"api_object_id": 5,
"children": [
{
"api_object_id": 5,
"children": [
{
"api_object_id": 5,
View xkit-catalog-react-npm.tsx
import * as React from 'react'
import createXkit from '@xkit-co/xkit-catalog.js'
const xkit = createXkit('viable.xkit.co')
interface IntegrationsProps {
path?: string
}
class Integrations extends React.Component<IntegrationsProps> {
@treygriffith
treygriffith / xkit-catalog-react.tsx
Created Jan 29, 2021
Using the Xkit Embedded Catalog with React
View xkit-catalog-react.tsx
import * as React from 'react'
import * as ReactDOM from 'react-dom'
interface IntegrationsProps {
path?: string
}
class Integrations extends React.Component<IntegrationsProps> {
private ref = React.createRef()
@treygriffith
treygriffith / Dockerfile
Created Aug 13, 2020
Dockerfile for building a release for Amazon Linux on EC2
View Dockerfile
# Building an Phoenix (Elixir) Release targeting Amazon Linux for EC2
# By https://github.com/treygriffith
# Original by the Phoenix team: https://hexdocs.pm/phoenix/releases.html#containers
#
# Note: Build context should be the application root
# Build Args:
# OTP_VERSION - the OTP version to target, like 23.0
# ELIXIR_VERSION - the Elixir version to target, like 1.10.4
#
# If you have other environment variables in config/prod.secret.exs, add them as `ARG`s in this file
View keybase.md

Keybase proof

I hereby claim:

  • I am treygriffith on github.
  • I am tgriff3 (https://keybase.io/tgriff3) on keybase.
  • I have a public key ASCPR31q17gz3kciMUmPWdACY4WRSmMXIw1w3LooYDurvwo

To claim this, I am signing this object:

@treygriffith
treygriffith / sample_async_belongsto_save.js.coffee
Created Nov 11, 2014
Saving an Ember record with an async belongsTo relationship
View sample_async_belongsto_save.js.coffee
comment = @store.createRecord('comment', {
author: @get('currentUser')
# snip
})
comment.get('author').then ->
# comment.author is now resolved, safe to save
comment.save()
@treygriffith
treygriffith / application_serializer.js.coffee
Last active Aug 29, 2015
Async Polymorphic BelongsTo Fix in Ember
View application_serializer.js.coffee
Teleborder.ApplicationSerializer = DS.ActiveModelSerializer.extend
serializePolymorphicType: (record, json, relationship) ->
key = relationship.key
belongsTo = record.get(key)
jsonKey = "#{key}_type".underscore()
if relationship.options.async
belongsTo = belongsTo.content
if Ember.isNone(belongsTo)
@treygriffith
treygriffith / immutable_dict.py
Created Oct 18, 2014
An Immutable Dictionary in python - a tuple with real keys
View immutable_dict.py
class ImmutableDict:
"""A tuple with non-index keys"""
def __init__(self, dict):
self._keys = tuple(dict.keys())
self._values = tuple(dict.values())
def __len__(self):
return len(self._keys)
@treygriffith
treygriffith / gist:4599072
Created Jan 22, 2013
Demonstrate behavior of MongoDB $in on Array properties
View gist:4599072
toy1 = {
color: ['red', 'purple']
};
toy2 = {
color: ['pink', 'orange']
}
Toys.find({color: { $in: ['red', 'green', 'blue'] }}, cb);
// finds toy1, but not toy2
@treygriffith
treygriffith / gist:4599048
Created Jan 22, 2013
Demonstrate behavior of MongoDB $in on primitive properties
View gist:4599048
toy1 = {
color: 'red'
};
toy2 = {
color: 'pink'
}
Toys.find({color: { $in: ['red', 'green', 'blue'] }}, cb);
// finds toy1, but not toy2