Skip to content

Instantly share code, notes, and snippets.

@rootedsoftware
rootedsoftware / CosmosDB queries
Created January 10, 2020 14:45
Common CosmosDB queries I can never remember
Find a document that has an array value of "artist" in the keyAudience array
where ARRAY_CONTAINS(c.keyAudiences, "artist")
https://github.com/prisma/prisma-cloud-feedback/issues/202#issuecomment-414095090
I looked up prisma's latest docker hub tags at https://hub.docker.com/r/prismagraphql/prisma/tags/ and picked 1.14-heroku (not sure what the difference is in *-heroku tags, but it sounded reasonable. Could someone from Prisma explain the difference?)
I read Heroku's docs on docker deployment and followed this section: https://devcenter.heroku.com/articles/container-registry-and-runtime#pushing-an-existing-image.
Here's the exact steps I ran:
Pulled the docker image w/ the tag mentioned above: docker pull prismagraphql/prisma:1.34-heroku
Looked up the image id from the image I just pulled using: docker images
Using that image id, I tagged it to my Heroku repo: docker tag 6ff588b05d59 registry.heroku.com/${HEROKU_APP_NAME}/web
@rootedsoftware
rootedsoftware / findDuplicatesInArrayOfObjects.js
Last active October 18, 2019 20:14
Sort an Array by property, then find the duplicates by that property
const users = [
{
firstName: 'Sarah',
lastName: 'Zulu',
email: '[email protected]',
},
{
firstName: 'Josh',
lastName: 'Able',
email: '[email protected]',
@rootedsoftware
rootedsoftware / sortArrayOfObjects.js
Last active October 18, 2019 20:06
Sort an Array of Objects in JS
const users = [
{
firstName: 'Sarah',
lastName: 'Zulu',
},
{
firstName: 'Josh',
lastName: 'Able',
},
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
import Inbox from './Inbox';
import TaskList from '../components/TaskList';
const withData = graphql(
gql`
query InboxQuery {
me {
@rootedsoftware
rootedsoftware / gist:7be337529c9bda8475abf2b818dce733
Created August 31, 2016 13:47
Function which converts string "Y" or "N" to true and false
var convertStringToBoolean = function(yourVariable){
return yourVariable ? yourVariable === "Y" ? true : false : null;
}
@rootedsoftware
rootedsoftware / gist:1abfffd4544a8d438cf0
Created March 26, 2015 22:05
Stripe update customer
Trying this
Stripe.customers.update(customer_id, {
"metadata.city": form['address.city'],
"metadata.state": form['address.state'],
"metadata.address_line1": form['address.address_line1'],
"metadata.address_line2": form['address.address_line2'],
"metadata.postal_code": form['address.postal_code'],
"metadata.phone": form.phone
}, function (error, customer) {
// Import the official balanced nodejs package
var balanced = require('balanced-official');
// Create a new API Key and configure the client with it
// The client automatically creates a new test marketplace for us
// if a marketplace does not exist for the api key
balanced.configure(apikey);
// Create a customer with some dummmy data
balanced.get('https://api.balancedpayments.com/debits/WD5rJ4kojAowU1YW4pz86Tb').then(function(debit) {
[
{
"_id" : "Philippines Infrastructure",
"total" : 3400,
"count" : 1
},
{
"_id" : "Philippines Urgent",
"total" : 1100,
"count" : 1
{ _api:
I20141209-15:18:16.384(-6)? { base_url: 'https://api.balancedpayments.com/',
I20141209-15:18:16.385(-6)? request_args: { headers: [Object], auth: [Object] },
I20141209-15:18:16.385(-6)? routes:
I20141209-15:18:16.385(-6)? { marketplaces: [Object],
I20141209-15:18:16.385(-6)? customers: [Object],
I20141209-15:18:16.385(-6)? bank_accounts: [Object],
I20141209-15:18:16.385(-6)? orders: [Object] },
I20141209-15:18:16.385(-6)? cache:
I20141209-15:18:16.385(-6)? { '/marketplaces/TEST-MP14BPoPFdKRdPSEx6V15MIl': [Object],