Skip to content

Instantly share code, notes, and snippets.

View JCMais's full-sized avatar
🚀
Being Happy

Jonathan Cardoso JCMais

🚀
Being Happy
View GitHub Profile
@JCMais
JCMais / MutationUtils.js
Created March 20, 2018 18:07 — forked from sibelius/MutationUtils.js
Helper methods for Relay Modern updater
// @flow
import { ConnectionHandler } from 'relay-runtime';
import { isObject, isArray } from 'lodash/fp';
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) {
const parentProxy = store.get(parentId);
const items = parentProxy.getLinkedRecords(parentFieldName);
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName);
}
@JCMais
JCMais / MutationUtils.js
Created March 20, 2018 18:07 — forked from sibelius/MutationUtils.js
Helper methods for Relay Modern updater
// @flow
import { ConnectionHandler } from 'relay-runtime';
import { isObject, isArray } from 'lodash/fp';
export function listRecordRemoveUpdater({ parentId, itemId, parentFieldName, store }) {
const parentProxy = store.get(parentId);
const items = parentProxy.getLinkedRecords(parentFieldName);
parentProxy.setLinkedRecords(items.filter(record => record._dataID !== itemId), parentFieldName);
}
// eslint-disable-next-line import/no-extraneous-dependencies
const NodeEnvironment = require('jest-environment-node');
const MongodbMemoryServer = require('mongodb-memory-server');
class MongoDbEnvironment extends NodeEnvironment {
constructor(config) {
super(config);
// eslint-disable-next-line new-cap
this.mongod = new MongodbMemoryServer.default({
instance: {
@JCMais
JCMais / .zshrc
Last active March 11, 2019 14:38
I will use this keep notes of stuff I keep forgetting, and some aliases I use
### Just some aliases that can be added to your source
### some k8s ones were copied from https://gist.github.com/tuannvm/04487aec37d2056d8a4b4c4b9d53dd16#file-k8s-bashrc
# Get resources
# kget <pod|deployment|svc> <resource-name> <option>
kget() {
kubectl get $@
}
# Change context
@JCMais
JCMais / k8s-cluster.json
Created January 4, 2019 13:01
Grafana dashboards from kubernetes app but using prometheus metrics instead of the datasource from the plugin
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@JCMais
JCMais / react-native-svg.js
Last active August 1, 2023 00:12
React Native SVG mock to be used with jest, put in __mocks__ dir in the src dir.
// @flow
// https://github.com/FormidableLabs/react-native-svg-mock
import React from 'react';
const createComponent = function(name: string) {
return class extends React.Component {
// overwrite the displayName, since this is a class created dynamically
static displayName = name;