Skip to content

Instantly share code, notes, and snippets.

View ibnumalik's full-sized avatar

Shaiful Aiman Malik ibnumalik

View GitHub Profile
@ibnumalik
ibnumalik / jetbrains-mono-nerd.css
Created December 5, 2022 09:10
JetBrains Mono CSS
@font-face {
font-family: "JetBrains Mono";
src: url("https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/JetBrainsMono/Ligatures/Regular/complete/JetBrains%20Mono%20Regular%20Nerd%20Font%20Complete.ttf");
font-weight: normal;
font-style: normal;
}
@ibnumalik
ibnumalik / alldebrid-services.js
Last active September 13, 2022 03:01
get all services supported in alldebrid
const [hosts, streams] = document.querySelectorAll('.downloaders_list');
/**
* Get list of services in alldebrid platform.
*
* @param {NodeListOf<Element>} services Use either `hosts` or `streams`
* @returns Object { downloaders_available?: string[]; downloaders_unavailable?: string[] }
*/
function getServiceList(services) {
let group = {};
@ibnumalik
ibnumalik / angular---auth.guard.ts
Last active September 13, 2022 03:04
(angular) Auth guard to check if user is logged in
import { Injectable } from '@angular/core';
import { CanLoad, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { AuthQuery } from './state/auth.query';
import { tap, take } from 'rxjs/operators';
@Injectable({
providedIn: 'root',
})
export class AuthGuard implements CanLoad {
@ibnumalik
ibnumalik / obj-url-params.js
Created June 18, 2020 14:46
Convert object to url params
/**
* Convert object to url params.
*
* @param obj Object
*/
function objToUrlParams(obj) {
return Object.entries(obj)
.map(([key, val]) => (!val ? null : `${key}=${val}`))
.filter(Boolean)
.join('&');
@ibnumalik
ibnumalik / must-match.ts
Created April 15, 2020 08:05
Angular password confirmation validation
import { FormGroup } from '@angular/forms';
export function MustMatch(controlName: string, matchingControlName: string) {
return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName];
const matchingControl = formGroup.controls[matchingControlName];
if (matchingControl.errors && !matchingControl.errors.mustMatch) {
return;
}
@ibnumalik
ibnumalik / startup.bat
Created November 19, 2016 17:58 — forked from dcrystalj/startup.bat
windows conEmu startup aliases
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*
doskey ls=ls $1 --color
doskey ll=ls -la --color
doskey sbl = sublime $*
doskey sshs = ssh tom@188.230.237.133
doskey oocd = openocd-x64-0.6.1 -f .\stm32f4discovery.cfg
doskey oocd7 = openocd-x64-0.7.0 -f .\stm32f4discovery.cfg
doskey sshkey = type C:\Users\dcrystalj\.ssh\id_rsa.pub | clip & echo "ssh key in clipboard"
:: Git