Skip to content

Instantly share code, notes, and snippets.

View whoisryosuke's full-sized avatar
👾
Going deep with game development

Ryosuke whoisryosuke

👾
Going deep with game development
View GitHub Profile
@whoisryosuke
whoisryosuke / markdown-directory-tree.md
Created July 27, 2020 21:03
Markdown / Documentation - Generate Markdown-friendly directory / folder tree structure - @see: https://stackoverflow.com/a/23990108
  1. Install the Linux package tree using Homebrew: brew install tree
  2. Run the tree command on any directory to generate a Markdown friendly structure: tree your-directory

You can save it to a file by piping the results into a text file: tree . >> directory-structure.md

Example

packages/button
├── lib
@whoisryosuke
whoisryosuke / Update-branch.md
Created September 17, 2019 17:38 — forked from santisbon/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@whoisryosuke
whoisryosuke / whoisryosuke-v1.osm.json
Created May 17, 2022 19:24
Oh My Posh - My Custom Theme (based on powerlevel10k + night-owl)
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#ffffff",
"foreground": "#000000",
"leading_diamond": "",
export default class EchoNode {
// We need a node that sits at the front of the chain and receives input data
// and sends it directly to output - and to the "echo" node chain
input: GainNode;
// The final output node for this effect
output: GainNode;
// The "echo" effect
delay: DelayNode;
// Amplifies "echo" effect
feedback: GainNode;
@whoisryosuke
whoisryosuke / BlueskyEmbed.tsx
Created May 1, 2025 04:28
React - Bluesky Embed
import React, { PropsWithChildren } from "react";
type Props = {
id: string;
userId: string;
};
// <BlueskyEmbed id="3lmcux5cabv2i" userId="itayxaatwwlwww4fp3jac3nn" />
const BlueskyEmbed = ({ id, userId, children }: PropsWithChildren<Props>) => {
const uri = `at://did:plc:${userId}/app.bsky.feed.post/${id}`
@whoisryosuke
whoisryosuke / prettier.sh
Created April 13, 2019 19:08
Prettier - Format or unminify code (single file or any folder of certain files)
# Quickly fix one file
npx prettier --write your-file.html
# Quickly fix all files of one type
npx prettier --write src/**/*.{js,jsx}
@whoisryosuke
whoisryosuke / ApiController.php
Created July 28, 2018 00:55
Laravel - API - Base Controller with standard API methods (index/store/etc) and authorization middleware ++ Extended controller and the necessary properties
<?php
namespace KushyApi\Http\Controllers;
use Illuminate\Http\Request;
use Spatie\QueryBuilder\QueryBuilder;
use KushyApi\Http\Controllers\Controller;
abstract class ApiController extends Controller
{
@whoisryosuke
whoisryosuke / api-form-submit.js
Created October 3, 2018 17:14
React - Handling forms and submitting POST data to API -- @see: https://reactjs.org/docs/forms.html
class NameForm extends React.Component {
constructor(props) {
super(props);
this.state = { name: '' };
}
handleChange = (event) => {
this.setState({[event.target.name]: event.target.value});
}
@whoisryosuke
whoisryosuke / BlueskyFirehoseExample.tsx
Created November 26, 2024 21:38
Bluesky - Firehose Websocket Example for ReactJS
import React, { useEffect, useRef } from "react";
const FireHoseExample = () => {
const firehoseSocket = useRef<WebSocket | null>(null);
useEffect(() => {
firehoseSocket.current = new WebSocket(
"wss://jetstream2.us-east.bsky.network/subscribe?wantedCollections=app.bsky.feed.post"
);
@whoisryosuke
whoisryosuke / react-onclick-proper-target.jsx
Last active October 20, 2024 15:38
React/JS - How to target "parent" instead of child during onClick (problem: e.target refs actual child clicked, instead of onClick wrapper)
const submitForm = (e) => {
// ❌ Targets child
console.log(e.target.value)
// ✅ Targets wrapper with onClick prop
console.log(e.currentTarget.value)
// ✅ If above fails, log currentTarget and see if it looks like HTML
// currentTarget usually returns as type of HTMLElement