Skip to content

Instantly share code, notes, and snippets.

credit: https://stackoverflow.com/questions/39356413/how-to-add-a-custom-ca-root-certificate-to-the-ca-store-used-by-pip-in-windows/52961564
>pip config set global.cert path/to/ca-bundle.crt
>pip config list # user trusted-host
pip.ini or pip.conf
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
cert = /etc/ssl/certs/ca-bundle.crt
@muhozi
muhozi / kenyan_counties.json
Created January 15, 2023 17:03 — forked from Aroniez/kenyan_counties.json
List of kenyan counties and their sub-counties in json format
[
{
"name": "Baringo",
"capital": "Kabarnet",
"code": 30,
"sub_counties": [
"Baringo central",
"Baringo north",
"Baringo south",
"Eldama ravine",
@muhozi
muhozi / tailwind-colors.json
Created August 13, 2022 14:20
Tailwind colors
{
"slate-50": "#f8fafc",
"slate-100": "#f1f5f9",
"slate-200": "#e2e8f0",
"slate-300": "#cbd5e1",
"slate-400": "#94a3b8",
"slate-500": "#64748b",
"slate-600": "#475569",
"slate-700": "#334155",
"slate-800": "#1e293b",
@muhozi
muhozi / memoizedHandlers.js
Created January 22, 2021 15:45 — forked from kyleshevlin/memoizedHandlers.js
Using React.useMemo to create a `handlers` object
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.
@muhozi
muhozi / Strings_vs_Integers.js
Created October 30, 2020 23:38
If you model your data to use integers instead of strings for hashmap keys, you can avoid a lot of cloning/hashing and get at least 20x perf boost!
let strings = [];
numbers = [];
for (let i = 0; i < 1000000; i++) {
strings.push(`${i}`.repeat(100));
numbers.push(i);
}
(() => {
console.time('numbers');
@muhozi
muhozi / database.rules.json
Created June 23, 2019 13:10 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
firebase.storage.TaskEvent.STATE_CHANGED,
snapshot => {
let state = {};
state = {
...state,
progress: (snapshot.bytesTransferred / snapshot.totalBytes) * 100 // Calculate progress percentage
};
@muhozi
muhozi / App.js
Last active May 30, 2019 14:24
React Native Navigation with Redux
import React, { Component } from 'react';
import {
View, Platform,
} from 'react-native';
import { Provider } from 'react-redux';
import { Navigation } from 'react-native-navigation';
import Splash from '../containers/Splash';
import Auth from '../containers/Auth';
import Profile from '../containers/Profile';
@muhozi
muhozi / .eslintrc
Created May 11, 2019 19:35 — forked from 1natsu172/.eslintrc
My airbnb based ESLint config for "typescript-eslint" with React & prettier
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
"env": {
"browser": true,
"jest/globals": true
},
@muhozi
muhozi / App.js
Created April 1, 2019 20:58
React native image upload
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Image,
FlatList,
AsyncStorage,
Dimensions,