Skip to content

Instantly share code, notes, and snippets.

View mramirid's full-sized avatar

Amir Muhammad Hakim mramirid

View GitHub Profile
@mramirid
mramirid / auto-setuju-survey-siamik-upnjatim.js
Last active January 7, 2023 02:15
Auto setuju survei lembaga di Siamik UPN Jawa Timur - untuk anda yang malas mengisi survei saat mendaftar UTS/UAS
document.querySelectorAll('[value="Setuju"]').forEach((setuju) => (setuju.checked = true));
document.getElementById("securityCode").scrollIntoView();
@mramirid
mramirid / avl.c
Last active March 24, 2021 10:17
AVL Tree implementation in C (from GeeksforGeeks)
#include <stdio.h>
#include <stdlib.h>
#undef max
struct Node_AVL
{
int value;
int height;
struct Node_AVL *left, *right;
@mramirid
mramirid / typescriptreact.json
Last active July 31, 2021 17:14
VSCode function component snippets for React Web & React Native (TSX)
{
"TSX Function Component for React Web": {
"prefix": "cmp-web",
"body": [
"interface $1Props {}\n",
"export default function $1(props: $1Props) {",
"\treturn (",
"\t\t<div>",
"\t\t\t<p>$1</p>",
"\t\t</div>",
@mramirid
mramirid / auto-bind-this.ts
Last active January 31, 2022 13:18
Automatically bind methods to their class instance
/**
* It binds the function to the class instance.
*/
function AutoBind(_: any, __: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value
const adjustedDescriptor: PropertyDescriptor = {
configurable: true,
enumerable: false,
get() {
const boundFunction = originalMethod.bind(this)
@mramirid
mramirid / AppName.php
Created April 5, 2020 14:45 — forked from isluewell/AppName.php
[6.0] Command app:name
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
use Symfony\Component\Finder\Finder;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputArgument;
@mramirid
mramirid / slugify.js
Last active January 31, 2022 05:01 — forked from codeguy/slugify.js
Create slug from string in Javascript
/**
* Convert a string to a URL slug
* @param {string} str - The string to be slugified.
* @returns {string} The slugified string.
*/
function toSlug(str) {
str = str.replace(/^\s+|\s+$/g, ""); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc