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
/**
* 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}.
@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 June 3, 2024 05:57
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 26, 2023 15:43
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
*/
@rstacruz
rstacruz / µredux.js
Created August 25, 2016 06:24
Redux in <1kb
var INIT = '@redux/INIT'
function createStore (reducer, state, enhancer) {
if (enhancer) return enhancer(createStore)(reducer, state)
var subscribers = []
dispatch({ type: INIT })
return {
@tec27
tec27 / deferred.js
Created July 9, 2016 02:15
An extension of ES6 Promises that allows for easier deferred resolution/rejection
class Deferred extends Promise {
constructor(executor) {
super(executor)
// These will be overwritten by the creator function
this._resolve = null
this._reject = null
}
resolve(value) {