Skip to content

Instantly share code, notes, and snippets.

View imAliAzhar's full-sized avatar
🎯
Focusing

Ali Azhar imAliAzhar

🎯
Focusing
View GitHub Profile
@imAliAzhar
imAliAzhar / transform.js
Last active June 30, 2021 17:30
A succint funtion that transforms JS Object to using a declarative schema
// Code
export const pickDeep = (obj: Dict<any>, key: string) =>
hasKey(obj, key) ? obj[key] : key.split(".").reduce((o, k) => o?.[k], obj);
export const transform = (from: Dict<any>, to: Dict<any>) =>
keys(to).reduce((o: Dict<any>, k) => {
const t = to[k]; // for each key that we want in the new object, get the transformer
o[k] = Array.isArray(t) // check if the transformer is an array
? typeof last(t) === "object" // if so, check if the last element of the transformer array is another 'to' object
@imAliAzhar
imAliAzhar / emoji-list
Last active January 15, 2023 17:59
Create an Emoji selector menu with Rofi
<span lang="face with tears of joy"> 😂 </span>
<span lang="grinning face with smiling eyes"> 😄 </span>
<span lang="grinning face with sweat"> 😅 </span>
<span lang="face with rolling eyes"> 🙄 </span>
<span lang="smirking face"> 😏 </span>
<span lang="smiling face with halo"> 😇 </span>
<span lang="grinning face"> 😀 </span>
<span lang="squinting face with tongue"> 😝 </span>
<span lang="grinning face with big eyes"> 😃 </span>
<span lang="unamused face"> 😒 </span>
@imAliAzhar
imAliAzhar / emoji-list
Created June 28, 2019 08:22
Create an Emoji selector menu with Rofi
<span lang="face with tears of joy"> 😂 </span>
<span lang="grinning face with smiling eyes"> 😄 </span>
<span lang="grinning face with sweat"> 😅 </span>
<span lang="face with rolling eyes"> 🙄 </span>
<span lang="smirking face"> 😏 </span>
<span lang="smiling face with halo"> 😇 </span>
<span lang="grinning face"> 😀 </span>
<span lang="squinting face with tongue"> 😝 </span>
<span lang="grinning face with big eyes"> 😃 </span>
<span lang="unamused face"> 😒 </span>
@imAliAzhar
imAliAzhar / brightness.sh
Created October 7, 2018 20:27
Script to get brightness notification with dunst.
#!/bin/bash
# You can call this script like this:
# $./brightness.sh up
# $./brightness.sh down
# Based on sebastiencs' script (https://gist.github.com/sebastiencs/5d7227f388d93374cebdf72e783fbd6a)
function get_brightness {
xbacklight -get