Skip to content

Instantly share code, notes, and snippets.

View jottenlips's full-sized avatar
🌈

John Ottenlips Franke jottenlips

🌈
View GitHub Profile
@jottenlips
jottenlips / configgit.sh
Created August 17, 2022 18:21
Default git push behavior so you don't have to git push --set-upstream origin feature/your-branch
git config --global push.default current
@jottenlips
jottenlips / functional_helpers.ts
Created January 27, 2023 17:07
Compose and pipe functions
export const compose = (...functions: Array<Function>) => (initial: any) => functions.reduce((acc, cur) => cur(acc), initial)
export const pipe = (...functions: Array<Function>) => (initial: any) => functions.reverse().reduce((acc, cur) => cur(acc), initial)
export const parseSignedFacebookRequest = (signed_request) => {
const [encoded_sig, payload] = signed_request.split(".");
const secret = 'appsecret'; // Use your app secret here
// decode the data
const sig = base64Decode(encoded_sig);
const data = JSON.parse(base64Decode(payload));
// confirm the signature
@jottenlips
jottenlips / makeStylesMUI5React18.ts
Last active March 22, 2024 15:03
easier replacement for the deprecated mui-styles library
// this code is to make it easier to replace the deprecated mui-styles library, almost drop in
import { SxProps } from '@mui/material'
import { useMemo } from 'react'
type TStylesFunction = (
props?: any,
) => Record<string, React.CSSProperties | SxProps>
type TStyles = Record<string, React.CSSProperties | SxProps>
export const makeStylesHook = (styles: TStylesFunction | TStyles) => {
@jottenlips
jottenlips / requesttimer.sh
Last active June 10, 2024 16:14
Time a request
curl -w "DNS Lookup Time: %{time_namelookup} \nConnect time: %{time_connect} \nTLS Setup: %{time_appconnect} \nRedirect Time: %{time_redirect} \nTime to first byte: %{time_starttransfer} \nTotal time: %{time_total} \n" $0