Skip to content

Instantly share code, notes, and snippets.

View mickdelaney's full-sized avatar

mick delaney mickdelaney

View GitHub Profile
@mickdelaney
mickdelaney / SearchUser.tsx
Created July 21, 2022 07:34 — forked from hyochan/SearchUser.tsx
react native relay pagination
import { Animated, FlatList } from 'react-native';
import React, { FC, Suspense, useState } from 'react';
import type {
SearchUsersPaginationQuery,
SearchUsersPaginationQueryResponse,
SearchUsersPaginationQueryVariables,
} from '../../__generated__/SearchUsersPaginationQuery.graphql';
import {
graphql,
useLazyLoadQuery,
@mickdelaney
mickdelaney / metro.config.js
Created January 8, 2022 17:19 — forked from sibelius/metro.config.js
Metro config to make react native play nice with monorepos
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const blacklist = require('metro-config/src/defaults/blacklist');
const workspaces = getWorkspaces(__dirname);
module.exports = {
projectRoot: path.resolve(__dirname, 'packages/app'),
@mickdelaney
mickdelaney / esbuild-relay.js
Created May 5, 2021 06:07 — forked from sciyoshi/esbuild-relay.js
Esbuild plugin for compiling relay queries
import { promises } from "fs";
import crypto from "crypto";
import path from "path";
import { print, parse } from "graphql";
const plugin = {
name: "relay",
setup: build => {
build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => {
let contents = await promises.readFile(args.path, "utf8");
@mickdelaney
mickdelaney / relay.config.js
Created April 30, 2021 17:58 — forked from sibelius/relay.config.js
Relay Config that works well with monorepo, you can spread your fragments in many packages
module.exports = {
schema: './data/schema.graphql',
language: 'typescript',
src: '../.',
include: [
'./web/src/**',
'./shared/src/**',
],
};
@mickdelaney
mickdelaney / index.html
Created December 7, 2019 23:31 — forked from belDom/index.html
Step wizard with flexbox
<div ng-app="stepWizardApp" ng-controller="stepWizardCtrl">
<ol class="step-wizard">
<li ng-repeat="step in steps" ng-class="stepStyle($index)"ng-click="">
<span class="number-circle" ng-bind="step.number"></span>
<span class="step-name" ng-bind="step.name"></span>
</li>
</ol>
</div>
@mickdelaney
mickdelaney / README.md
Created July 29, 2017 15:37 — forked from kentcdodds/README.md
upload-file

upload-file angular-formly type

This is my upload-file type for what I use at work. We use angular-upload for the upload service to do the actual file uploading. We also have several abstractions and use ES6 that may confuse you a little bit (sorry about that). Hopefully this gets you started though.

@mickdelaney
mickdelaney / postgres_queries_and_commands.sql
Created May 24, 2017 21:24 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mickdelaney
mickdelaney / pyspark-udf.py
Created January 8, 2017 20:13 — forked from zoltanctoth/pyspark-udf.py
Writing an UDF for withColumn in PySpark
from pyspark.sql.types import StringType
from pyspark.sql.functions import udf
maturity_udf = udf(lambda age: "adult" if age >=18 else "child", StringType())
df = sqlContext.createDataFrame([{'name': 'Alice', 'age': 1}])
df.withColumn("maturity", maturity_udf(df.age))
@mickdelaney
mickdelaney / gist:b6e9f1ff3ab94ac93ac2
Created January 30, 2016 20:19 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
  1. General Background and Overview
@mickdelaney
mickdelaney / 0_reuse_code.js
Created January 21, 2016 10:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console