Skip to content

Instantly share code, notes, and snippets.

View srph's full-sized avatar
🛠️
Building @Stride-Labs Frontend

Kier Borromeo srph

🛠️
Building @Stride-Labs Frontend
View GitHub Profile
@Hona
Hona / code-like-luke.md
Created August 13, 2026 01:44
OpenCode slash command for happy-path-first, use-case-oriented software design
description Implement with clear orchestration, strong interfaces, and happy-path-first design

Code like Luke.

Implement the requested change, but optimize the design for the normal user flow. If the happy path is 95% of runtime behavior, it should be approximately 95% of the code readers see.

Start with context:

  • inspect the existing code, callsites, data flow, and nearby conventions
/**
* If you have a volume input (0 to 1), such as a slider, use this to convert
* it to a logarithmic volume that is closer to human perception (0 to 1).
*
* A more robust approach would use a Fletcher-Munson curve, however this is a
* close enough approximation for most use cases.
*
* You can customize the curve to your liking, generally 3-4 is a good value.
*
* The inverse of this function is {@link convertVolumeToInput}.
'BAL#000': 'ADD_OVERFLOW',
'BAL#001': 'SUB_OVERFLOW',
'BAL#002': 'SUB_UNDERFLOW',
'BAL#003': 'MUL_OVERFLOW',
'BAL#004': 'ZERO_DIVISION',
'BAL#005': 'DIV_INTERNAL',
'BAL#006': 'X_OUT_OF_BOUNDS',
'BAL#007': 'Y_OUT_OF_BOUNDS',
'BAL#008': 'PRODUCT_OUT_OF_BOUNDS',
'BAL#009': 'INVALID_EXPONENT',
@bradtraversy
bradtraversy / laravel_xampp_setup.md
Created April 22, 2022 01:16
Laravel Xampp setup on Mac and Windows

Laravel Xampp Setup (Windows & Mac)

Install Xampp

Install Xampp from https://www.apachefriends.org/index.html

  • Run the Xampp installer and open the Xampp control panel
  • Make sure that you enable the Apache and MySQL services
  • On mac you need to click "Start" on the Home tab, "Enable" on the Network tab and "Mount" on the Location Tab. Click "Explore" on the location tab to open your Xampp/Lampp folder

Install Composer

import { SigningStargateClient } from '@cosmjs/stargate'
import { fromBase64 } from "@cosmjs/encoding";
import {
makeAuthInfoBytes,
makeSignDoc,
} from '@cosmjs/proto-signing'
import { Int53, Uint53 } from "@cosmjs/math";
import { Any } from "cosmjs-types/google/protobuf/any";
import { PubKey } from "cosmjs-types/cosmos/crypto/secp256k1/keys";
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
@webmaster128
webmaster128 / TOUR_COMSJS_STARGATE.md
Last active August 9, 2026 21:32
CosmJS + Stargate – A guided tour

Support for Cosmos SDK Stargate in CosmJS has been ongoing work for several months now. Stargate is released and CosmJS is here to connect to it.

Starting points

Let's explore what is new for Stargate support:

@oieduardorabelo
oieduardorabelo / react-redux.ts
Created December 19, 2018 13:07
Module mock in Jest using `react-redux/connect` as example
const connect = jest.fn((mapStateToProps) => {
const React = require.requireActual('react');
const { rootReducer } = require.requireActual('../domains/root.reducer');
const state = rootReducer({}, { type: '__jest-mock-react-redux__' });
const fromConnectProps = mapStateToProps(state);
return jest.fn(Component => {
function Wrapper(props: any) {
const finalProps = { ...props, ...fromConnectProps };
@threepointone
threepointone / for-snook.md
Last active August 13, 2026 13:11
For Snook

https://twitter.com/snookca/status/1073299331262889984?s=21

‪“‬In what way is JS any more maintainable than CSS? How does writing CSS in JS make it any more maintainable?”

‪Happy to chat about this. There’s an obvious disclaimer that there’s a cost to css-in-js solutions, but that cost is paid specifically for the benefits it brings; as such it’s useful for some usecases, and not meant as a replacement for all workflows. ‬

‪(These conversations always get heated on twitter, so please believe that I’m here to converse, not to convince. In return, I promise to listen to you too and change my opinions; I’ve had mad respect for you for years and would consider your feedback a gift. Also, some of the stuff I’m writing might seem obvious to you; I’m not trying to tell you if all people of some of the details, but it might be useful to someone else who bumps into this who doesn’t have context)‬

So the big deal about css-in-js (cij) is selectors.

Language tips

Try to be mindful of your words in written communications. Here are some tricks to leaving a good impression with written words online.

Avoid "do" and "don't"

When writing imperative sentences, try not to start your sentences with "don't." Try the word "avoid" instead.

  • ⚠️ "Don't use big words."
    This imperative command can make the reader feel like they have no choice on the matter. It implies that the decision lies solely on you, which implies that you don't want to listen to their feedback.
@madcoda
madcoda / App.js
Created May 28, 2017 04:24
React-router v4 multi layout
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/