Skip to content

Instantly share code, notes, and snippets.

View fatlinesofcode's full-sized avatar

Philip Andrews fatlinesofcode

View GitHub Profile
@fatlinesofcode
fatlinesofcode / useAwaitState.ts
Last active September 6, 2023 23:41
custom useState hook to return a promise for setState which resolves when the state changes
import { useEffect, useRef, useState } from 'react'
/**
* return a promise that resolves when useState updates
*
* @usage
*
* * const [state, setState] = useAwaitState('')
*
* * await setState('newVal')
yarn add link:../
@fatlinesofcode
fatlinesofcode / RCTComponentViewManager.m
Created March 11, 2022 23:59
React Native ios uiview native component
#import <React/RCTViewManager.h>
@interface RCTComponentViewManager : RCTViewManager
@property (nonatomic, strong) UIView *wrapper;
@end
@implementation RCTComponentViewManager
/*
@fatlinesofcode
fatlinesofcode / vuex-log.js
Last active September 25, 2020 00:30
console log vuex state
console.log(document.getElementsByTagName('div')[0].__vue__.$store.state)
@fatlinesofcode
fatlinesofcode / .linstagedrc.js
Last active September 25, 2020 00:31
lintstaged php-cs-fixer docker config
const path = require('path')
const phpCsfixer = 'docker exec -i lep php ./vendor/bin/php-cs-fixer'
const toRelativePath = (absolutePaths) => {
const cwd = process.cwd()
const relativePaths = absolutePaths.map((file) => path.relative(cwd, file))
return relativePaths.join(' ')
}
/**
@fatlinesofcode
fatlinesofcode / zoomblur.html
Created June 17, 2017 04:30
Zoom blur shader for Three.js with Effect composer
<!-- https://codepen.io/fatlinesofcode/pen/yXVGPp -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color: #ffffff;
margin: 0;
overflow: hidden;
@fatlinesofcode
fatlinesofcode / _easing.sass
Last active February 3, 2016 03:02
Css easing equations as sass variables. Includes the Greensock power alias names
/*
* Css easing equations as sass variables. Includes the Greensock power alias names
* @usage : .myclass{ transition : opacity 0.5s $easeOutPower1 0.0s;}
*/
$linear : cubic-bezier(0.250, 0.250, 0.750, 0.750) !default
$ease : cubic-bezier(0.250, 0.100, 0.250, 1.000) !default
$ease-in : cubic-bezier(0.420, 0.000, 1.000, 1.000) !default
$ease-out : cubic-bezier(0.000, 0.000, 0.580, 1.000) !default
$ease-in-out : cubic-bezier(0.420, 0.000, 0.580, 1.000) !default