'(\d.)px'
$1
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 |
// 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) => { |
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 |
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) |
git config --global push.default current |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = getattr(settings, "XS_SHARING_ALLOWED_ORIGINS", '') | |
XS_SHARING_ALLOWED_METHODS = getattr(settings, "XS_SHARING_ALLOWED_METHODS", | |
['POST', 'GET', 'OPTIONS', 'PUT']) | |
def xssharing_middleware(get_response): | |
def middleware(request): | |
response = get_response(request) | |
if response.has_header('Access-Control-Allow-Origin'): |
https://github.com/callstack/haul/issues/463#issuecomment-408922287 |
#!/bin/bash | |
lowercase_remove_dash () { | |
sed -e 's/-//g' $1 | tr '[:upper:]' '[:lower:]' | |
} | |
find . -maxdepth 1 -regex '\./.*\.fsa' | while read file; do printf "%s\n" $(lowercase_remove_dash $file) > $file; done |
import { useEffect } from 'react'; | |
export const useDisableBodyScroll = (open) => { | |
useEffect(() => { | |
if (open) { | |
document.body.style.overflow = 'hidden'; | |
} else { | |
document.body.style.overflow = 'unset'; | |
} | |
}, [open]); |