Skip to content

Instantly share code, notes, and snippets.


Claus Wahlers claus

View GitHub Profile
claus / example.js
Created Sep 22, 2020
Proxy wrapper for tweenjs that automatically starts/stops requestAnimationFrame so you don't have to
View example.js
import { tween } from './tween';
tween({ x: 0 })
.to({ x: 1 }, 200)
.onStart(() => { console.log('onStart') })
.onStop(() => { console.log('onStop') })
.onComplete(() => { console.log('onComplete') })
.onUpdate(tweenObj => { console.log('onUpdate', tweenObj.x) })
claus / sbRichTextReactRenderer.js
Last active Aug 1, 2020
Storyblok Rich Text Renderer for React
View sbRichTextReactRenderer.js
storyblokRichTextRenderer(document, {
blokResolvers: {
// Resolve a blok to a custom React component
['test_blok']: props => <TestBlok {...props} />
nodeResolvers: {
// Resolve a node to a custom React component
View gist:7f80a5704a95b5d69925b5caaaada6a0
1D=@%:$D="$=E5H9HAI=E// 32 G.UBOBJ7I1M3I.H8EE5A3D3B / ,D F3J3;D?DIAP=YBW8S2P0P""D &1V9^;_A[AZ;S1V'=RCYEYMTMSDKCP=R&@ENSPSVNVMIB@E&JBWLYL_H^FP>JB":MO.0:V.19;3;0;19,1,0;0;5
claus /
Created Jun 15, 2020
Migrando de uma instância Mastodon para outra

Migrando de uma instância para outra

Este é o passo-a-passo de como migrar sua conta no mastodon de uma instância para outra. Você pode migrar tudo (seguidores, seguidos, silenciados e bloqueados) exceto seus toots e mídia, você pode exportá-los mas não pode importá-los na nova instância.

Primeiro de tudo, para migrar de uma instância para outra, você deve fazer uma nova conta na instância para a qual você quer mudar, então siga os passos abaixo:

  1. Na nova instância vá em Preferências > Conta > Configurações da conta


claus / _app.js
Created May 14, 2020
Restore scroll position after navigating via browser back/forward buttons in Next.js
View _app.js
import useScrollRestoration from "utils/hooks/useScrollRestoration";
const App = ({ Component, pageProps, router }) => {
return <Component {...pageProps} />;
export default App;
claus / flashforward.asm
Created Oct 16, 2019
6502 assembler intro for Flash Forward awards ceremony 2006 in Austin, Tx (FC64 emulator)
View flashforward.asm
; FC64 Flashforward Trailer
; =========================
; Basic: "1 SYS(2064)"
.a 0801
.b 0d,08,01,00,9e,28,32,30,36,34,29,00,00,00,00
claus / NextWorkboxPlugin.js
Last active Oct 15, 2019
Simple Webpack plugin to create Workbox based service workers for Next.js 9.1+ projects.
View NextWorkboxPlugin.js
const fs = require('fs');
const path = require('path');
const crypto = require('crypto');
const readdir = require('recursive-readdir');
const SW_NAME = 'sw.js';
const fileBlacklist = [
claus /
Created Sep 11, 2018
MacOS: capture screenshot and add it to IPFS
# Exit on errors
set -e
set -o pipefail
# Filename of captured image
FILE="$(date +%Y-%m-%d-%H-%M-%S).png"
# User/host
# Capture screen (interactively) and save image to the desktop
screencapture -i ~/Desktop/$FILE
# Upload the captured image to the server
claus / functions.php
Created Aug 17, 2018
Wordpress: Also search tags in addition to post title and content
View functions.php
function tax_search_join( $join, $query ) {
global $wpdb;
if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) {
$join .= "
{$wpdb->term_relationships} ON {$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id
{$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id
{$wpdb->terms} ON {$wpdb->terms}.term_id = {$wpdb->term_taxonomy}.term_id
claus /
Last active Aug 25, 2020
Data Prefetching in Next.js

Data Prefetching in Next.js

You can’t perform that action at this time.