Skip to content

Instantly share code, notes, and snippets.

View arbaz52's full-sized avatar
💭
Developing

Arbaz Ajaz arbaz52

💭
Developing
View GitHub Profile
@arbaz52
arbaz52 / index.html
Last active March 18, 2017 19:01
Awesome Welcome Block for Website
<html>
<head>
<link rel='stylesheet' href='welcome.css'>
<script src='welcome.js'></script>
</head>
<body>
<div id='welcome'>
<ul>
<li>W</li>
<li>e</li>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package letmecodeinjava;
/**
*
* @author doom
const _name = "arbaz";
const _str = `my name is ${_name}`;
console.log(_str);
// output:
// my name is arbaz
const _name = "arbaz"
const _age = 21
const fn = (strings, ...vars) => {
console.log("strings: ", strings)
console.log("vars: ", vars)
}
fn`my name is ${_name} and I'm ${_age} years old`
const _v1 = 10
const _v2 = 20
const sum = (strings, v1, v2) => {
return strings[0] + v1 + strings[1] + v2 + strings[2] + (v1+v2)
}
const result = sum`v1: ${_v1} + v2: ${_v2} = `
console.log(result)
@arbaz52
arbaz52 / keybindings.json
Created May 8, 2021 15:33
VS Code - Key bindings for movement if you hate using arrow keys.
[
/*
u i o
j k l
+
ctrl/alt/shift
alt + i/k/j/l move up/down/left/right on character (+ shift to select/highlight)
alt + u/o move to start/end of the current line (+ shift to select/highlight)
    u i o
    j k l
      +
ctrl/alt/shift

alt + i/k/j/l move up/down/left/right on character (+ shift to select/highlight)
alt + u/o move to start/end of the current line (+ shift to select/highlight)
alt + ctrl + j/l move start of current/left word | end of current/right word (+ shift to select/highlight)
const SYMBOLS = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000
}
@arbaz52
arbaz52 / usage.selective-context-consumer.tsx
Created July 22, 2021 08:07
Usage: Selective Context Consumer Library
import {
FC,
memo,
useRef,
useEffect,
useReducer,
useCallback,
createContext,
} from "react";
import { SelectiveContextConsumer } from "selective-context-consumer";
@arbaz52
arbaz52 / tsModifiers.ts
Created September 12, 2021 20:16
Typescript Custom Type Modifiers
export type ModifyKey<I, K extends keyof I, V> = Omit<I, K> &
{ [K in keyof I]: V };
export type PickAndModifyKey<I, K extends keyof I, V> = ModifyKey<
Pick<I, K>,
K,
V
>;
// key should be an interface/object