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
@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;
};
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active March 28, 2024 09:26
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.

@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 () => {
@clins777
clins777 / 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
@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);
@jlovald
jlovald / horriblesubsbatch.js
Last active June 15, 2019 10:55
Downloads a batch of episodes from horrible subs. Click on an anime to get to the download list. Run this script in the console (tested for chrome). And click on the copy button at the console output. Paste this into qbittorrent or another client that supports adding a batch of magnet links
// Change to the resolution you desire. "480p", "720p", "1080p".
var res = "1080p";
var x = document.getElementsByClassName("hs-shows")[0];
var li = x.childNodes;
var myRegexp = /<a title="Magnet Link" href="(.*)">Magnet/g;
var x = document.getElementsByClassName("hs-shows")[0];
var li = x.childNodes;
var links = "";
var btn = document.getElementsByClassName("more-button")[0];
@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 ###
@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;
}
`
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
// Subscriptions automatic helpers
autoSub = { readys: {}, managers: {} };
autoSubscribe = function(T, subKey, paramKey) {
T.onCreated(function() {
var self = this;
if (!_.has(autoSub.managers, subKey)) {
autoSub.managers[subKey] = new SubsManager();
}
if (!_.has(autoSub.readys, subKey)) {
autoSub.readys[subKey] = new ReactiveVar();