Skip to content

Instantly share code, notes, and snippets.

View underworld14's full-sized avatar
🎯
Focusing

Yusril Izza Aulia underworld14

🎯
Focusing
  • SoftwareSeni
  • Blitar, East Java
  • 01:01 (UTC +07:00)
View GitHub Profile

Setup Eslint Prettier and Husky in Node JS Typescript Project

1. ESLint

  • Step 1 - Install the dependencies

    • eslint
      • ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.
      • npm install --save-dev eslint
    • typescript-eslint/parser
@eveningkid
eveningkid / pan-responder-pan-scale-image-example.jsx
Created February 19, 2021 17:54
React Native Pan Responder example to pan/scale an image
import React, { useRef } from 'react';
import {
Animated,
Image,
PanResponder,
useWindowDimensions,
} from 'react-native';
const IMAGE_URI =
'https://vignette.wikia.nocookie.net/joke-battles/images/4/40/18360-doge-doge-simple.jpg/revision/latest?cb=20151209161638';
@benhatsor
benhatsor / IDFromTime.js
Last active February 10, 2024 15:47
Generate a unique ID based on the current time. Note: If you need a truly unique ID, use something like the JS Crypto API instead.
// Both numbers and letters
function mixedID() {
var now = new Date();
timestamp = now.getFullYear().toString();
timestamp += (now.getMonth < 9 ? '0' : '') + now.getMonth().toString();
timestamp += ((now.getDate < 10) ? '0' : '') + now.getDate().toString();
timestamp += now.getHours().toString();
timestamp += now.getMinutes().toString();
timestamp += now.getSeconds().toString();
server {
    listen 80;
    server_name 202.157.186.15;
    root /var/www/blog/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active July 14, 2025 09:28
Building a react native app in WSL2
@aslamdoctor
aslamdoctor / wsl-lamp.md
Last active December 17, 2024 19:41
Windows 10 - WSL LAMP Stack Setup
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active July 18, 2025 00:13
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@cameronblandford
cameronblandford / knexPostgresFullTextSearch.js
Last active November 8, 2023 07:35
Implement full text search using Knex + Objection
// Because we're using an ORM (Objection), it's a pain to add a tsvector when inserting,
// since tsvectors and FTS aren't supported by Objection. Instead, I've added a hook that
// fires on insert which auto-generates the tsvector field for each newly inserted entry.
// This is an example knex migration file for said behavior.
const addUserIndex = `
ALTER TABLE public.user ADD "document" tsvector;
CREATE FUNCTION my_trigger_function()
RETURNS trigger AS $$
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active May 30, 2025 09:01
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <[email protected]>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
@lucasscariot
lucasscariot / model-user.js
Last active October 27, 2024 00:48
Composite Primary Key in Sequelize
/*
* Migration
*/
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Users', {
firstName: {
type: Sequelize.STRING
},