Skip to content

Instantly share code, notes, and snippets.

View ianmartorell's full-sized avatar
🏠
Working from home

Ian Martorell ianmartorell

🏠
Working from home
  • Barcelona, Spain
View GitHub Profile
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active May 5, 2024 15:12
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.

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@newswim
newswim / antd_sc_example.js
Created August 4, 2017 22:42
Wrapping Ant Design components with Styled Components
import { Link } from 'react-router-dom'
import { Badge, Col, Menu } from 'antd'
const StyledBadge = styled(Badge)`
.ant-badge-count {
background-color: #7ECBBF;
color: white;
box-shadow: 0 0 0 1px #d9d9d9 inset;
}
`
@paigen11
paigen11 / findUser.js
Created September 4, 2018 20:50
Passport local and Passport JWT authentication with custom callbacks examples with a user registration MERN service.
import passport from 'passport';
module.exports = app => {
app.get('/findUser', (req, res, next) => {
passport.authenticate('jwt', { session: false }, (err, user, info) => {
if (err) {
console.log(err);
}
if (info != undefined) {
console.log(info.message);
@revett
revett / git_branch_naming.md
Last active December 22, 2023 17:12
Git Branch Naming Conventions

Syntax

<author>/<type>/<ticket>/<title>

Example

revett/feature/24101/skeleton-service-for-email-sender
@lapastillaroja
lapastillaroja / DividerItemDecoration.java
Last active November 17, 2023 23:06 — forked from akmalxxx/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@wyozi
wyozi / inngestEncrypted.ts
Created August 17, 2023 08:39
inngest encrypted step.run return value
import crypto from "crypto";
import { StepOpts } from "inngest/types";
const CRYPTO_KEY = process.env.BACKGROUND_VAR_CRYPTO_KEY;
export type Encrypted<T> = {
iv: string;
ciphertext: string;
};
@JonnyWong16
JonnyWong16 / plex_discord_rpc.py
Last active May 26, 2023 03:01
Discord Rich Presence for Plex
import asyncio
import json
import os
import struct
import sys
import time
from plexapi.myplex import MyPlexAccount
### EDIT SETTINGS ###
@nandorojo
nandorojo / _app.tsx
Last active August 2, 2022 16:12
React Native Web + Next.js Scroll Restoration
// pages/_app.js
import ReactNativeNextJsScrollRestore from '../react-native-next-scroll-restore'
import { useEffect } from 'react'
function MyApp({ Component, pageProps }) {
useEffect(() => {
const unsubscribe = ReactNativeNextJsScrollRestore.initialize()
return () => {
@clins1994
clins1994 / unfollow-everyone-on-instagram.js
Last active December 19, 2021 18:04
Unfollow Everyone on Instagram
// HOW TO RUN IT ON GOOGLE CHROME
// 1. OPEN INSTAGRAM
// 2. OPEN LIST OF FOLLOWERS
// 3. OPEN DEVELOPER TOOLS
// 4. COPY EVERYTHING HERE CTRL + A
// 5. PASTE EVERYTHING IN DEVELOPER TOOLS CONSOLE
// 6. CLICK ENTER
// THERE YOU WILL SOON HAVE NO FRIENDS
const FOLLOWING_BUTTON_TEXT = 'フォロー中' // CHANGE THIS TO YOUR LANGUAGE