Skip to content

Instantly share code, notes, and snippets.

building

Jesco Wüster jescowuester

building
View GitHub Profile
@jescowuester
jescowuester / linkedin accept bot
Created May 12, 2020
accept all linkedin requests except recruiters
View linkedin accept bot
[...document.querySelectorAll(".invitation-card")].forEach(t=>{/recruit/gi.test(t.querySelector(".invitation-card__subtitle").textContent)?t.querySelector(".artdeco-button--tertiary").click():t.querySelector(".artdeco-button--secondary").click()});
View dev.to top post data
[
{
"time": "2019-10-06T20:19:53.000Z",
"title": "9 Projects you can do to become a Frontend Master in 2020",
"tags": [
"#react",
"#vue",
"#angular",
"#javascript"
],
View linkedin accept
[...document.querySelectorAll('.invitation-card')].forEach(card => {
const jobTitle = card.querySelector('.invitation-card__subtitle').textContent
const isRecruiter = /recruit/gi.test(jobTitle)
const acceptButton = card.querySelector('.artdeco-button--secondary')
const denyButton = card.querySelector('.artdeco-button--tertiary')
if(isRecruiter){
denyButton.click()
}else{
@jescowuester
jescowuester / randomColor.js
Created Apr 6, 2020
generates a random, highly distinguishable number for every number. Adjust
View randomColor.js
function selectColor(number) {
const hue = number * 137.508 // use golden angle approximation
const saturation = '100%'
const lightness = '50%'
return `hsl(${hue},${saturation},${lightness})`
}
@jescowuester
jescowuester / tween.js
Last active Mar 14, 2020
a basic tweening function, where the value is updated via cb. adjusted for perfect 60fps movement
View tween.js
const _raf =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function(f) {
window.setTimeout(f, 1e3 / 60);
};
@jescowuester
jescowuester / orbitControls.js
Created Jan 2, 2020
orbit controls for react three fiber
View orbitControls.js
extend({OrbitControls})
const Controls = props => {
const {gl, camera} = useThree()
const ref = useRef()
useRender(() => ref.current.update())
return <orbitControls ref={ref} args={[camera, gl.domElement]} {...props} />
}
View countries.js
const countries = [
{
ISO: 'AD',
name: 'Andorra',
demonym: 'Andorran'
},
{
ISO: 'AE',
name: 'United Arab Emirates',
demonym: 'Emirian',
View common data to copy paste
months: ['January','February','March','April','May','June','July','August','September','October','November','December']
react-select: [
{value: 'january', label:'January'},
{value: 'february', label:'February'},
{value: 'march', label:'March'},
{value: 'april', label:'April'},
{value: 'may', label:'May'},
{value: 'june', label:'June'},
{value: 'july', label:'July'},
{value: 'august', label:'August'},
View pipe.js
const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x);
View useCtx.ts
import { createContext, useContext } from 'react';
// check https://github.com/typescript-cheatsheets/react-typescript-cheatsheet#context
export default function createCtx<A>() {
const ctx = createContext<A | undefined>(undefined);
function useCtx() {
const c = useContext(ctx);
if (!c) throw new Error('useCtx must be inside a Provider with a value');
You can’t perform that action at this time.