Skip to content

Instantly share code, notes, and snippets.

View princefishthrower's full-sized avatar
💭
codevideo.io 🎥

Chris Frewin princefishthrower

💭
codevideo.io 🎥
View GitHub Profile
pipelines:
branches:
master:
- step:
name: Install npm modules with npm install and build production site with npm run build
script:
- npm install
- npm run build
artifacts:
- node_modules/**
pipelines:
branches:
master:
- step:
name: Install npm modules and build production site via tsc
script:
- npm install
- tsc
artifacts:
- node_modules/**
pipelines:
branches:
master:
- step:
name: Install npm modules and build production site via tsc
script:
- npm install
- tsc
artifacts:
- node_modules/**
pipelines:
branches:
staging:
- step:
name: Copy Staging Environment (.env.staging.json) to .env.json
script:
- cp /src/env/.env.staging.json /src/env/.env.json
<<<rest of install, build, SCP, SSH scripts and commands>>>
master:
- step:
pipelines:
branches:
staging:
- step:
name: Copy Staging Environment (.env.staging.json) to .env.json
script:
- cp /src/env/.env.staging.json /src/env/.env.json
- curl -X POST -H 'Content-type: application/json' --data '{"text":"Staging environment copied into environment!"}' YOUR_WEBHOOK_URL_HERE
master:
- step:
@princefishthrower
princefishthrower / ExampleUsage.cs
Created March 26, 2021 07:30
Dynamic Where Expressions With EF Core
public List<AppParkingOrderModel> GetHourlyIntersectedBookingsByFacility(string facilityName)
{
var searchCriteria = new List<Expression<Func<AppParkingOrderModel, bool>>>();
var now = DateTime.Now;
var yearFromNow = now.AddYears(1).Year;
var startDateTime = new DateTime(now.Year, 1, 1, 0, 0, 0);
var endDateTime = new DateTime(yearFromNow, 1, 1, 0, 0, 0);
var hours = (endDateTime - startDateTime).TotalHours;
@princefishthrower
princefishthrower / usePleaseStay.ts
Created April 26, 2021 07:07
A React hook that will animate the document title and / or favicon!
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,
@princefishthrower
princefishthrower / KeyboardShift.tsx
Last active October 6, 2022 21:01
A Keyboard Avoiding View for React Native in 2021
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()
@princefishthrower
princefishthrower / KeyboardShiftUsage.tsx
Last active October 3, 2021 10:23
A basic boilerplate of how to use the KeyboardShift component.
import KeyboardShift from './KeyboardShift'
export default function YourCoolKeyboardScreen () {
// Other logic, variables, etc.
return (
<KeyboardShift>
{/* Screen components */}
</KeyboardShift>
@princefishthrower
princefishthrower / buildColorPrompt.zsh
Created September 30, 2021 21:12
Transform your zsh shell prompt into a letter-level alternating color kaleidoscope!
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"