Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Building things.

Charly POLY wittydeveloper

👷‍♂️
Building things.
View GitHub Profile
View user-mutation.graphql
type Mutation {
update_user(id: String!, user: UserInputType): User
}
input UserInputType {
first_name: String
last_name: String
picture_path: String
job_title: String
email: String
View apollo-form-user.ts
import * as React from 'react';
/* imports ... */
import { client } from '../../core/apollo';
const jsonSchema: JSONSchema6 = require('./core/apollo-form-json-schema.json');
// this is common for the whole application, brang here for the example.
const AlineSidebarForm = configure<ApolloFormMutationNames>({
client,
jsonSchema,
theme: alineSidebarTheme
View redux-form-framework.ts
import * as React from 'react';
/* imports ... */
import { pick } from 'lodash';
class Form extends ModuleForm {
fields: FieldsDefinitions = {
id: 'none',
email: 'none',
picture_path: {
type: 'image', transformations: 'h_200,w_200,r_max,c_fill'
View user-fragments.ts
export interface BasicUserFragment {
id: string,
first_name: string,
last_name: string,
username: string | null,
picture_path: string | null,
active: boolean,
portfolio_id: string | null,
job_title: string | null,
email: string,
View example.pac
function FindProxyForURL(url, host) {
// If the hostname matches, use proxy.
if (
shExpMatch(host, "*.aline.work") ||
shExpMatch(host, "aline.work") ||
shExpMatch(host, "*.ipify.org")
) {
return "PROXY xx.xx.xx.xx:8888";
}
View ts-react-proptypes.tsx
// without TypeScript
import PropTypes from 'prop-types';
class Greeting extends React.Component {
render() {
return (
<h1>Hello, {this.props.name}</h1>
);
}
View segment-sample.json
{
"anonymousId": "<removed>",
"context": {
"library": {
"name": "analytics.js",
"version": "3.2.5"
},
"page": {
"path": "<removed>",
"referrer": "<removed>",
View react-apollo-perf-monitoring-link.ts
View execute-aws-athena-query.js
exports.handler = (event, context, callback) => {
var AWS = require('aws-sdk');
AWS.config.update({region: 'eu-west-1'}); // configure region
const athena = new AWS.Athena();
athena.getNamedQuery({ NamedQueryId: '<your-query-id>' }, function(err, data) {
console.log('getNamedQuery', err, data);
if (!err) {
var params = {
QueryString: data.NamedQuery.QueryString,
View react-apollo-network-helper.ts
import { NetworkStatus, isNetworkRequestInFlight } from 'apollo-client/core/networkStatus';
type isNetworkTransitionArg = {
networkStatus: NetworkStatus;
};
export enum NetworkTransition {
LOADED_DATA,
WAS_IN_CACHE,
LOADING,