Skip to content

Instantly share code, notes, and snippets.

@SahilK-027
SahilK-027 / KMP.cpp
Last active April 25, 2024 12:16
KMP
// String p # s
// S: a a b # a a b a a b a a b
// LPS: 0 1 0 0 1 2 3 1 2 3 1 2 3
vector<int> KMP(string& s){
vector<int> LPS(s.length(), 0);
for(int i = 1 ; i < s.length(); i++){
int prev_idx = LPS[i-1];
while(prev_idx > 0 && s[i] != s[prev_idx]){
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
@Xynonners
Xynonners / AHAA.gdshader
Last active April 25, 2024 12:15
new godot antialiasing (Absurd Hybrid Anti-Aliasing)
shader_type spatial;
render_mode unshaded, depth_prepass_alpha;
void vertex() {
POSITION = vec4(VERTEX, 1.0);
}
uniform sampler2D BackBufferTex : hint_screen_texture, repeat_disable, filter_nearest;
uniform sampler2D DepthBufferTex : hint_depth_texture, repeat_disable, filter_nearest;

Gambaran umum

Struktur folder ini dibuat berdasarkan prinsip enkapsulasi dan modularisasi. Jadi kodingan-kodingan yang ada dipisah-pisah menjadi modul-modul kecil sesuai fungsi masing masing. Dalam menjalankan fungsinya, setiap modul tidak boleh ada ketergantungan langsung dengan modul yang lain. Di projek android ini secara umum ada beberapa fungsi:

  1. Fetch API
    • Model
    • Proses Request dan Response
    • Autentikasi
  2. Token Management (storage)
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 25, 2024 12:14
Complete Recent Discord Quest

Complete Recent Discord Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
@knowbody
knowbody / RNfontWeights.js
Created July 14, 2016 13:42
React Native Font Weight Cheatsheet iOS
{ fontWeight: '100' }, // Thin
{ fontWeight: '200' }, // Ultra Light
{ fontWeight: '300' }, // Light
{ fontWeight: '400' }, // Regular
{ fontWeight: '500' }, // Medium
{ fontWeight: '600' }, // Semibold
{ fontWeight: '700' }, // Bold
{ fontWeight: '800' }, // Heavy
{ fontWeight: '900' }, // Black

Install Jellyfin on Termux [In Proot]

This guide shows two methods of installing Jellyfin on termux

Note: only tested on aarch64/arm64

These steps are same for both methods:

  1. Update the repo
pkg update
@wpscholar
wpscholar / vagrant-cheat-sheet.md
Last active April 25, 2024 12:11
Vagrant Cheat Sheet

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@wojteklu
wojteklu / clean_code.md
Last active April 25, 2024 12:09
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@tobyselway
tobyselway / laravel_setup.md
Last active April 25, 2024 12:07
Initial Setup for Laravel Projects

Initial Setup

1. Clone the repository

Find a location on your computer where you want to store the project. A directory made for projects is generally a good choice.

Launch a bash console there and clone the project.

git clone https://github.com/organization/project.git

2. cd into the project