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
export default function findInArray<T>( | |
arr: T[], | |
callback: (element: T, index: number, array: T[]) => boolean | |
): T | undefined { | |
if (typeof callback !== 'function') { | |
throw new TypeError('callback must be a function') | |
} | |
const list = Object(arr) | |
// Makes sure it always has a positive integer as length. |
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
/** | |
* isEven | |
* @param {number} | |
*/ | |
export function isEven(num) { | |
return num % 2 === 0; | |
} | |
/** | |
* Count Items |
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
# FFMPEG Cmds | |
# https://ffmpeg.org/ffmpeg-all.html#Video-Options | |
# -i input file | |
# Basic convert mov to mp4 | |
ffmpeg -i input.mov output.mp4 | |
# Simple Compress ( amount by -b 2500k) | |
# -b: bitrate |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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, { useEffect } from 'react' | |
import Router, { useRouter } from 'next/router' | |
function PageTrans(props) { | |
const router = useRouter() | |
let transTime = 100 | |
useEffect(() => { | |
const handleRouteExit = () => { | |
document.documentElement.classList.remove('page-trans-entered') |
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 | |
# First, run a fetch to update all origin/<branch> refs to latest: | |
git fetch --all | |
# Backup your current branch: | |
git checkout -b backup-master |
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
/** | |
* DopeModule | |
*/ | |
const DopeModule = (function() { | |
// Module Constants | |
const ACTIVE_CLASS_NAME = 'is-active'; | |
// Module Vars |
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
mkdir component-name && cd component-name | |
npm init -y && git init | |
npm install --save react react-dom | |
npm install --save-dev @babel/core @babel/plugin-proposal-class-properties @babel/preset-env @babel/preset-react parcel-bundler | |
touch .gitignore | |
mkdir src | |
touch src/index.html | |
atom . |
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, { useState, useEffect, useRef } from "react"; | |
function Cursor() { | |
const cursorDotOutline = useRef(); | |
const cursorDot = useRef(); | |
const requestRef = useRef(); | |
const previousTimeRef = useRef(); | |
let [mousePosition, setMousePosition] = useState({ x: 0, y: 0 }); | |
const [width, setWidth] = useState(window.innerWidth); | |
const [height, setHeight] = useState(window.innerHeight); |
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 Player from '@vimeo/player'; | |
/** | |
* ViemoPlaylist | |
* Class for interacting with the Vimeo API | |
* to create a continous playlist of vids | |
* @class | |
* @requires @vimeo/player | |
* @param {html element id} el - player element passed to Vimeo's imported Player class. | |
* @param {object} options - plugin options for api and playlist ids |
NewerOlder