Skip to content

Instantly share code, notes, and snippets.

View arasovic's full-sized avatar
💻
Working from home

Mehmet Aras arasovic

💻
Working from home
View GitHub Profile
@ozcanzaferayan
ozcanzaferayan / useTabPress.ts
Created February 10, 2024 12:14
useTabPress.ts
import { useNavigation } from "expo-router";
import { useEffect } from "react";
import { FlatList } from "react-native";
export const useTabPressScroll = <T>(ref: React.RefObject<FlatList<T>>) => {
const navigation = useNavigation();
useEffect(() => {
// @ts-expect-error tabPress is not in the type
const unsub = navigation.addListener("tabPress", (evt) => {
if (navigation.isFocused()) {
@lucahammer
lucahammer / delete-tweets.js
Last active October 21, 2025 05:42
Delete all your Tweets Javascript
/*
This may get your account banned. It runs in your regular browser with your regular login without needing the API.
The script does the same things that you would do yourself:
Click the three dots, select delete Tweet, confirm, scroll to next Tweet, repeat.
==========================
Usage
1. Open your Twitter profile in a browser
2. Open the console in the developer tools (F12)
3. Paste the script and press enter
4. ???
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active October 29, 2025 13:25
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@fongandrew
fongandrew / react-bind.md
Last active January 14, 2024 16:02
Explaining why we bind things in React

Start With This

Before getting to React, it's helpful to know what this does generally in Javascript. Take the following snippet of code. It's written in ES6 but the principles for this predate ES6.

class Dog {
  constructor() {

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?