Skip to content

Instantly share code, notes, and snippets.

View siamak's full-sized avatar
🎯
Focusing

Siamak siamak

🎯
Focusing
View GitHub Profile
@ZulianTiger
ZulianTiger / digitalocean-deployment.txt
Last active May 3, 2024 00:35
How to Deploy a Next.js Website to a DigitalOcean Server
***Simple and stripped down version of this post: https://www.coderrocketfuel.com/article/how-to-deploy-a-next-js-website-to-a-digital-ocean-server ***
1. Create a New Droplet On DigitalOcean
a) In the first section, select the Ubuntu operating system for your server
b) In the "Authentication" section, make sure the "Password" option is selected and enter a strong root password for your server.
2. Access Server Using Root
a) ssh root@server_ip_address (connect to server from terminal)
3. Add user (OPTIONAL)
@cvan
cvan / css-ios-pwa-viewport.css
Created April 3, 2020 22:14
CSS for env(safe-area-inset-top) for iOS "Add to Homescreen" / PWA; standalone styles
@supports (padding-top: constant(safe-area-inset-top)) {
body {
padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
}
@media (display-mode: fullscreen) {
body {
padding: 0;
}
@derindutz
derindutz / use-persistent-swr.ts
Last active January 6, 2023 08:11
useSWR with localforage as a persistent cache
import useSWR from '@zeit/swr';
import localForage from 'localforage';
import { ConfigInterface } from '@zeit/swr/dist/src/types';
import { useState, useEffect } from 'react';
export function usePersistentSWR(key: string, fn?: Function, config?: ConfigInterface) {
let handleSuccess;
if (config !== undefined && config.onSuccess !== undefined) {
const { onSuccess } = config;
handleSuccess = (data: any, key: string, config: ConfigInterface) => {
@santiago
santiago / AesUtil.js
Created November 14, 2018 16:27 — forked from AndiDittrich/AesUtil.js
Node.js - AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// AES Encryption/Decryption with AES-256-GCM using random Initialization Vector + Salt
// ----------------------------------------------------------------------------------------
// the encrypted datablock is base64 encoded for easy data exchange.
// if you have the option to store data binary save consider to remove the encoding to reduce storage size
// ----------------------------------------------------------------------------------------
// format of encrypted data - used by this example. not an official format
//
// +--------------------+-----------------------+----------------+----------------+
// | SALT | Initialization Vector | Auth Tag | Payload |
// | Used to derive key | AES GCM XOR Init | Data Integrity | Encrypted Data |

Libraries and Tools for React

If you're developing an application based on React it can be helpful if you don't need to develop all the basic UI components yourself. Here you can find a list with various components, component libraries and complete design systems developed with and for React.

As the list got longer and longer I thought it would be better to have a "real" site for it.

👉 Please find the (new) list here: https://react-libs.nilshartmann.net/

@stroebs
stroebs / make-chr.sh
Last active March 16, 2024 06:13
Install Mikrotik CHR on a Digital Ocean droplet (Ubuntu 20.04 tested working 29/03/2022)
#!/bin/bash
#
# Digital Ocean Ubuntu 18.04 x64 Droplet with "Regular Intel" CPU.
# Running:
# git clone https://gist.github.com/54fc09734a3911e91eeeb43434f117df.git
# cd 54fc09734a3911e91eeeb43434f117df/
# chmod +x make-chr.sh
# ./make-chr.sh
#
# Once the reboot is done, login with root/CHANGEME and change the password!
// # Usage
//
// Save this file and replace username and password on the last line of the file with
// your Snapp username and password then run the following commands:
//
// yarn init && yarn add request
// node SnappTotalPriceCalculator.js
//
const request = require('request');
@bigsergey
bigsergey / review-checklist.md
Last active May 3, 2024 18:11
Front-end Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
@sekoyo
sekoyo / adaptiveComponent.js
Last active February 2, 2019 19:43
Loading different components at runtime depending on media queries in React
/* globals matchMedia */
import React, { PureComponent } from 'react';
function adaptiveComponent(mediaQueries) {
const firstMatchingQuery = Object.keys(mediaQueries).find(mediaQuery =>
matchMedia(mediaQuery).matches);
if (!firstMatchingQuery) {
throw new Error(`No media query matches found in ${mediaQueries}`);
}