Skip to content

Instantly share code, notes, and snippets.

View lalosh's full-sized avatar

Louay Al-osh lalosh

View GitHub Profile
@mmikhan
mmikhan / tailwind.config.js
Created June 17, 2020 14:12
Tailwind CSS `grid-template-columns: auto-fit; grid-template-columns: auto-fill;` and `grid-template-rows: auto-fit; grid-template-rows: auto-fill;`
module.exports = {
purge: [],
theme: {
extend: {
gridTemplateColumns: {
'auto-fit': 'repeat(auto-fit, minmax(0, 1fr))',
'auto-fill': 'repeat(auto-fill, minmax(0, 1fr))',
},
gridTemplateRows: {
'auto-fit': 'repeat(auto-fit, minmax(0, 1fr))',
@yovko
yovko / ohmyzsh.md
Last active May 10, 2024 20:28
ZSH (using Oh My ZSH) on Manjaro Linux

ZSH (using Oh My ZSH) on Manjaro Linux

0. If ZSH is not already installed on your Manjaro system you can do it with the command:

sudo pacman -Syu zsh

You do not need to install manjaro-zsh-config and all the other related packages like zsh-syntax-highlighting, zsh-history-substring-search, zsh-autosuggestions, etc., as we will use Oh My Zsh.

@enqtran
enqtran / [ReactJS] Detect Scrolls To Bottom
Last active May 25, 2022 19:16
[ReactJS] Detect Scrolls To Bottom
constructor(props) {
super(props);
this.state = {
height: window.innerHeight,
message: 'not at bottom'
};
this.handleScroll = this.handleScroll.bind(this);
}
handleScroll() {
const windowHeight = "innerHeight" in window ? window.innerHeight : document.documentElement.offsetHeight;
@mikaturunen
mikaturunen / calculateHmac.js
Last active January 25, 2023 08:11
Example of calculating hmac in node.js
import * as crypto from 'crypto'
const merchantSecret = 'secret'
const hash = 'sha256'
const encoding = 'base64'
const payload = {
id: 123,
somethingElse: 'not 123'
}
@staltz
staltz / comment.md
Created March 15, 2017 15:27
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

@d2s
d2s / installing-node-with-nvm.md
Last active March 13, 2024 12:09
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.