Skip to content

Instantly share code, notes, and snippets.

@lprhodes
lprhodes / bookmarks.ts
Created September 1, 2022 07:56
Relay Pagination Mock
// React Component
function ProfileBookmarksScreen(props): JSX.Element {
const { componentId, relayPagination } = props
const { data: user, loadNext, hasNext, refetch } = relayPagination
return (
<>
<div>
{(user?.bookmarkedPostsWithCursor?.edges ?? []).map((edge) => {
@lprhodes
lprhodes / .eslintrc.json
Created April 19, 2022 20:25
Parenthoods opinionated eslint, tsconfig and prettier
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
@lprhodes
lprhodes / convertCdkToCloudFormationTemplate.sh
Last active December 22, 2022 07:25
A script that will create a Formation template from a CDK script and also create its assets. To be used along side SAM and tsc-watch for real-time lambda updates.
#!/bin/bash
# This script is designed to replace the existing cdk.out asset directory used by SAM
# otherwise a new asset directory will be created that can't be seen by SAM until SAM is re-run.
echo "Creating cdk output directory"
mkdir -p tmp/cdk.out
ASSET_DIRS=($(ls -d1 tmp/cdk.out/asset*))
DIR_COUNT=${#ASSET_DIRS[*]}
@lprhodes
lprhodes / graphUtils.js
Last active March 11, 2024 10:21
GraphQL JS (ES6): Convert GraphQLObjectType to GraphQLInputObjectType
// GraphQL Utils
// Module Vars
import {
graphql,
GraphQLObjectType,
GraphQLInputObjectType,
GraphQLID
} from 'graphql';
import { isInputType } from 'graphql/type/definition';
@lprhodes
lprhodes / gist:7d5c99abfa60217eb4a7
Created August 5, 2014 04:24
processing of userDataQueue item.
processQueueItem = function(value, callback) {
var queueObj = value;
var adjustment = queueObj.adjustment;
var userUID = queueObj.userUID;
var obj = queueObj.obj;
var objs = queueObj.objs;
//We can store multilpe objects within a single queue'd item so that they get processed together.
if (objs) {
Why I love contracting.
**Flexibility**
While I definitely taylor my hours to the clients I'm working with, the flexibility of contracts allow me to change the hours I work on a day to day basis. Maybe I'll sleep in on Monday and make up for the hours on the evening, or do some extra hours at the weekend to get a head start on the week. Some people need structure, maybe I'm just lucky that I don't and have a great drive in me to work.
**Control**
If I want a new Mac for work...I'll not only buy one, I'll buy the fastest one the software I run can make use of. I want some software to make my work easier, or at least feel easier - I'll purchase it. If I need temporary servers to make tasks easier, I get them. If I want to watch a film or write a blog post during the day, I will.
Why I love contracting.
**Flexibility**
While I definitely taylor my hours to the clients I'm working with, the flexibility of contracts allow me to change the hours I work on a day to day basis. Maybe I'll sleep in on Monday and make up for the hours on the evening, or do some extra hours at the weekend to get a head start on the week. Some people need structure, maybe I'm just lucky that I don't and have a great drive in me to work.
**Control**
If I want a new Mac for work...I'll not only buy one, I'll buy the fastest one the software I run can make use of. I want some software to make my work easier, or at least feel easier - I'll purchase it. If I need temporary servers to make tasks easier, I get them. If I want to watch a film or write a blog post during the day, I will.
@lprhodes
lprhodes / blockIssue
Created March 28, 2012 15:56
//Return type 'id' must match previous return type 'void *' when block literal has unspecified explicit return type
//Return type 'id' must match previous return type 'void *' when block literal has unspecified explicit return type
typedef id (^AEURLResponseProcessor)(NSURLResponse *, id, NSError **);
+ (AEURLResponseProcessor)statusCode:(NSIndexSet *)acceptableCodes {
return [[^(NSURLResponse *response, id data, NSError **error){
if (![response isKindOfClass:[NSHTTPURLResponse class]]) {
if (error) {
*error = [AEExpect error:AEExpectResponseNotHTTPError
@lprhodes
lprhodes / libPusher.crash
Created February 29, 2012 17:55
libPusher Crash Log
Incident Identifier: 670E5206-9295-4BC1-891C-E767AF9A7FAD
CrashReporter Key: 8032dfc4784a8d5e1721794ced3590db04cdef21
Hardware Model: iPhone4,1
Process: PusherApp [2188]
Path: /var/mobile/Applications/2F3C771A-8428-49BC-BFF1-9BE8A5BE2CB3/Football Feeder.app/Football Feeder
Identifier: PusherApp
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
@lprhodes
lprhodes / hueRotation.FSH
Created February 20, 2012 23:41
hue rotation
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float hueAdjust;
precision mediump float;
// no need to compute these...
const float sqrt2 = 1.414213562373095;
const float sqrt3 = 1.732050807568877;
const float oneoversqrt2 = 0.707106781186548;
const float oneoversqrt3 = 0.577350269189626;