Skip to content

Instantly share code, notes, and snippets.

View JohnBra's full-sized avatar
💪
covert memester

Bronathan JohnBra

💪
covert memester
View GitHub Profile
@JohnBra
JohnBra / rename.py
Created May 12, 2024 01:22
Renames image files to their creation date. Modified to work with heic files
# Rename Images with Date Photo Taken
# Purpose: Renames image files in a folder based on date photo taken from EXIF metadata
# Original Author: Matthew Renze
# Usage: python.exe rename.py input-folder
# - input-folder = (optional) the directory containing the image files to be renamed
# Examples: python rename.py /path/to/photos
@JohnBra
JohnBra / 2k6k_japanese_core_cards.html
Last active March 30, 2024 00:50
2k6k front, back and styling
<!-- Copy everything for the respective card side in between the START and END comments -->
<!-- Front of card START -->
<div style="font-size: 18px;">{{hint:Vocabulary-Kana}}</div>
<div style="font-size: 50px;">{{Vocabulary-Kanji}}</div>
<div style="font-size: 25px;">{{hint:Expression}}</div>
<!-- Front of card end END -->
@JohnBra
JohnBra / increment_number.sql
Created May 29, 2023 10:31
A simple function to increment a number on a postgres database like Supabase
drop function increment_views;
create function increment_views(post_slug text)
returns setof public.posts as
$$
update public.posts
set views = views + 1
where slug = post_slug;
select * from public.posts where slug = post_slug;
@JohnBra
JohnBra / jitai.user.js
Created January 6, 2023 21:52 — forked from obskyr/jitai.user.js
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
// ==UserScript==
// @name Jitai
// @version 1.3.2
// @description Display WaniKani reviews in randomized fonts, for more varied reading training.
// @author Samuel (@obskyr)
// @copyright 2016-2018, obskyr
// @license MIT
// @namespace http://obskyr.io/
// @homepageURL https://gist.github.com/obskyr/9f3c77cf6bf663792c6e
// @icon http://i.imgur.com/qyuR9bD.png
@JohnBra
JohnBra / search_users.js
Created October 24, 2022 04:56 — forked from pereayats/search_users.js
Find your potential clients on Twitter using some keywords
const OAuth = require('oauth')
const async = require('async')
const _ = require('lodash')
// YOU CAN FIND THIS ON YOUR TWITTER DEVELOPER CONSOLE
const CLIENT_ID = 'YOUR TWITTER CONSUMER KEY'
const CLIENT_SECRET = 'YOUR TWITTER CONSUMER SECRET'
const ACCESS_TOKEN = 'YOUR ACCESS TOKEN'
const ACCESS_SECRET = 'YOUR ACCESS SECRET'
@JohnBra
JohnBra / GlowingGradientBorderButton.tsx
Last active September 15, 2023 16:14
A TailwindCSS glowing gradient border button
import React from 'react'
function cn(...classes: any[]) {
return classes.filter(Boolean).join(' ')
}
type Props = {
gradient: string // 'bg-gradient-to-r from-red-600 via-purple-600 to-blue-600',
children: React.ReactNode
href: string
@JohnBra
JohnBra / useStorage.tsx
Created July 4, 2022 22:44
Typed React useStorage hook for chrome extensions
import { Dispatch, SetStateAction, useState, useEffect, useCallback, useRef } from 'react';
export type StorageArea = 'sync' | 'local';
// custom hook to set chrome local/sync storage
// should also set a listener on this specific key
type SetValue<T> = Dispatch<SetStateAction<T>>;
/**
@JohnBra
JohnBra / next-mailchimp
Created December 8, 2021 01:56
Simple Mailchimp sign up form for nextjs with tailwindcss
import React, { useState } from 'react';
import Link from 'next/link';
import MailchimpSubscribe from 'react-mailchimp-subscribe';
import { CheckCircleIcon, InformationCircleIcon, XCircleIcon } from '@heroicons/react/solid';
export default function EmailList(): JSX.Element {
// error currently not used
const [error, setError] = useState(null);
const [email, setEmail] = useState('');
import React from "react";
export default class Canvas extends React.Component {
constructor(props) {
super(props);
this.state = {
canvasWidth: window.innerWidth,
canvasHeight: window.innerHeight,
mouseX: 0,