Skip to content

Instantly share code, notes, and snippets.

View adibfirman's full-sized avatar

Adib Firman adibfirman

View GitHub Profile
@adibfirman
adibfirman / better-git-branch.sh
Created January 14, 2024 00:56 — forked from schacon/better-git-branch.sh
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'

#Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux

If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.

The full error message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@adibfirman
adibfirman / 00-README-NEXT-SPA.md
Created March 20, 2023 14:03 — forked from gaearon/00-README-NEXT-SPA.md
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Building

@adibfirman
adibfirman / css-color-regex
Created August 24, 2022 01:59 — forked from olmokramer/css-color-regex
Regex for CSS colors: hex, rgb(a), hsl(a)
/(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\d{1,3}%?(,\s?\d{1,3}%?){2},\s?(1|0?\.\d+)\)|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?\)){2})/i
@adibfirman
adibfirman / .eslintrc.js
Created August 6, 2020 03:27 — forked from sibelius/.eslintrc.js
eslint rule to disable internal imports in a monorepo
'no-restricted-imports': [
'error',
{
patterns: ['@app/**/src'],
},
],

Introduction

So, basically this is just a note for a how to completely install a vim as well, for your awesome editor

  1. install the neovim and the plugins
  2. and then setup the config (~/.config/nvim/init.vim) like this
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
@adibfirman
adibfirman / react-rollup-typescript.md
Last active July 9, 2020 02:56
react + rollup + typescript boilerplate

Terminal

mkdir app-name && cd app-name && yarn init -y
yarn add -D rollup @rollup/plugin-typescript typescript react react-dom @rollup/plugin-node-resolve rollup-plugin-commonjs rollup-plugin-auto-external
mkdir src dist
touch src/index.tsx

package.json

@adibfirman
adibfirman / README.md
Created April 14, 2020 02:35 — forked from tannerlinsley/README.md
How to fix the multiple-instances of React error when using linked NPM modules that import React as a peer dependency

How to fix the multiple-instances of React error when using linked NPM modules that import React as a peer dependency

Back-link your linked module's React dependency back to your application's React

In your app that you are receiving the multiple-version error:

  • Go to node_modules/react
  • Run yarn link

In your linked module that also uses React:

  • Run yarn link react

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@adibfirman
adibfirman / util-elastic-collision.js
Created January 6, 2020 03:58 — forked from christopher4lis/util-elastic-collision.js
A set of utility functions used to reproduce the effect of elastic collision within HTML5 canvas. Used in the Chris Courses tutorial video on collision detection: https://www.youtube.com/watch?v=789weryntzM
/**
* Rotates coordinate system for velocities
*
* Takes velocities and alters them as if the coordinate system they're on was rotated
*
* @param Object | velocity | The velocity of an individual particle
* @param Float | angle | The angle of collision between two objects in radians
* @return Object | The altered x and y velocities after the coordinate system has been rotated
*/