Skip to content

Instantly share code, notes, and snippets.

View peiris's full-sized avatar
🍃

Kasun Peiris peiris

🍃
View GitHub Profile
@peiris
peiris / 00-README-NEXT-SPA.md
Created March 18, 2023 13:22 — 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

@peiris
peiris / react-software-engineer-practical-test.md
Last active July 27, 2021 16:48
React.js Software engineer practical test

React.js software engineer practical test

In this practical test, we build a simple CRUD application called 🍔 The Fridge. We use this application to see what we have in our fridge at a glance and when do they expire.

Please read the instructions properly before you proceed.

⚙️ Tech Stack to be used

  • React.js (Latest)
  • TailwindCSS
ssh-import-id gh:<username>
@peiris
peiris / README-Template.md
Created August 29, 2019 12:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@peiris
peiris / How to Increase Maximum Upload File Size in WordPress
Last active June 25, 2019 11:36
How to Increase Maximum Upload File Size in WordPress
1. Update .htaccess file
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
OR
@peiris
peiris / Setup PHP and Composer on OSX via Brew.md
Created June 23, 2019 02:18 — forked from shashankmehta/setup.md
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@peiris
peiris / Clear all Node Modules Folders Recursively Mac-Linux
Last active June 2, 2019 17:19
Clear all Node Modules Folders Recursively Mac/Linux
- Open your terminal.
- Browse to your master project directory or the top level of where you have a bunch of projects stored.
- Run the command: ``find . -name "node_modules" -type d -prune -exec rm -rf '{}' +``
####How it works
``find .`` Instructs the find program to search for files in the current directory ..
``-name "node_modules"`` Instructs the find program to search for files named “node_modules”.
``-type d`` Instructs the find program to only look for file directories named “node_modules”.
``-prune`` Instructs the find program to not descend into the current file/directory for it to exclude child “node_modules” directories. On Mac, since -d was specified, -prune has no effect on the find program’s lookup results (per the man pages). However, on Linux, -prune still instructs the find program to not descend into the current file/directory.
@peiris
peiris / gist:c184f11bada6b7d969c9d3e45fcac195
Created May 2, 2019 09:50 — forked from ayamflow/gist:b602ab436ac9f05660d9c15190f4fd7b
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@peiris
peiris / nginx-tuning.md
Created April 27, 2019 16:17 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@peiris
peiris / gist:30c5318b8e72b0e132873856d2f7a5f4
Created November 9, 2018 11:05 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master