This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This Netlify serverless function will send a warning email / SMS if the bandwidth is close to the specified limits. | |
// Many environment variables need to be set in order for this function to work: | |
// - MJ_API_KEY (Mailjet API key) | |
// - MJ_API_SECRET (Mailjet API secret) | |
// - SINCH_SERVICE_PLAN_ID (Sinch service plan ID) | |
// - SINCH_API_TOKEN (Sinch API token) | |
// - SINCH_NUMBER (Sinch phone number) | |
// - SINCH_TO_NUMBER (Sinch phone number to send the SMS to) | |
// - NETLIFY_ACCESS_TOKEN (Netlify access token) - generate one at https://app.netlify.com/sites/{your-site-name}/settings/general#access-control | |
// - NETLIFY_API_BANDWIDTH_URL (Netlify API bandwidth URL) - should have this pattern: https://api.netlify.com/access-control/bb-api/api/v1/accounts{your-account-id}/bandwidth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Best run with "scrapy runspider asshats.py --nolog" in your terminal | |
import time | |
import scrapy | |
from selenium import webdriver | |
# Variables needed - or, throw this garbage in a loop to produce ultimate ass-hattery | |
url = "https://somesubstackurl.substack.com/" | |
email = "[email protected]" | |
class MyAsshatSpider(scrapy.Spider): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useIsFocused} from '@react-navigation/native'; | |
import * as React from 'react'; | |
import {useRef} from 'react'; | |
import {TextInput, View} from 'react-native'; | |
import {isIOS} from '../../helpers/utils'; | |
import {useTimeout} from '../../hooks/useTimeout'; | |
export interface IOTPInputProps { | |
otpCodeChanged: (otpCode: string) => void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Extracts the source code of any Docker tag! | |
# Inspired by Sambhav Jain's post on DEV: https://dev.to/sambhav2612/reverse-engineering-a-docker-image-i8c | |
# Simply pass: | |
# 1. The desired Docker image tag you want to get the source code for | |
# 2. The target folder to put the source code in | |
# | |
# Example usage: | |
# ./export-source-from-docker-tag.sh gcr.io/google-samples/gb-frontend:v4 docker-source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [didShowListener, setDidShowListener] = useState<EmitterSubscription | null>() | |
const [didHideListener, setDidHideListener] = useState<EmitterSubscription | null>() | |
useEffect(() => { | |
setDidShowListener(Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow)); | |
setDidHideListener(Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide)); | |
return () => { | |
if (didShowListener){ | |
didShowListener.remove(); | |
} | |
if (didHideListener) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildColorPrompt() { | |
# I always like showing what directory I am in (special character "\w" in PS1) - store the equivalent in this 'directory' variable | |
directory=$(pwd) | |
# Modify these to whatever you'd like! | |
PROMPT_TEXT="awesome-shell-prompt-colors@awesome-machine [$directory] " | |
# Colors seperated by comma - acceptable values are: | |
# black, white, red, green, yellow, blue, magenta, cyan, light gray, light red, light green, light yellow, light blue, light magenta, light cyan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildColorPrompt() { | |
# I always like showing what directory I am in | |
directory=$(pwd) | |
# Modify these to whatever you'd like! | |
PROMPT_TEXT="youruser@yourmachine [$directory]" | |
# Comma seperated colors - as many or as few as you'd like | |
PROMPT_COLORS="15" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import KeyboardShift from './KeyboardShift' | |
export default function YourCoolKeyboardScreen () { | |
// Other logic, variables, etc. | |
return ( | |
<KeyboardShift> | |
{/* Screen components */} | |
</KeyboardShift> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PropsWithChildren, useEffect, useState } from 'react'; | |
import { Platform, Animated, Dimensions, Keyboard, KeyboardAvoidingView, StyleSheet, TextInput } from 'react-native'; | |
import {useHeaderHeight} from '@react-navigation/elements'; | |
import { useKeyboard } from '@react-native-community/hooks'; | |
export default function KeyboardShift (props: PropsWithChildren<{}>) { | |
const { children } = props; | |
const [shift, setShift] = useState(new Animated.Value(0)) | |
const keyboard = useKeyboard() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef, useState } from 'react'; | |
import { getFavicon } from '../../helpers/getFavicon'; | |
import { AnimationType } from '../../enums/AnimationType'; | |
import { UsePleaseStayOptions } from '../../types/UsePleaseStayOptions'; | |
import { useInterval } from '../useInterval'; | |
export const usePleaseStay = ({ | |
titles, | |
animationType = AnimationType.LOOP, | |
interval = 1000, |
NewerOlder