Skip to content

Instantly share code, notes, and snippets.

View MunifTanjim's full-sized avatar
🧐
What's happening?

Munif Tanjim MunifTanjim

🧐
What's happening?
View GitHub Profile
@MunifTanjim
MunifTanjim / index.html
Last active May 26, 2017 11:42
Gist Embedder - Example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Gist Embedder</title>
<script src='https://unpkg.com/gist-embedder/dist/gist-embedder.min.js'></script>
</head>
<body>
const getDigitsArray = numberString => numberString.split('')
const getProbableNumbers = (placeholder, numberString) => {
let probableNumbers = []
let stuffedDigitsArray = getDigitsArray(numberString).map(
digit =>
digit == placeholder ? [null, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] : [digit]
)

Keybase proof

I hereby claim:

  • I am muniftanjim on github.
  • I am muniftanjim (https://keybase.io/muniftanjim) on keybase.
  • I have a public key ASBtCQ0HCm8FntYup1HO5tEDjWOwW8k0nRNiUT5QvnfK6wo

To claim this, I am signing this object:

@MunifTanjim
MunifTanjim / RoutineTermSectionEdit.js
Created April 28, 2019 20:47
React Hooks Component Example
import Form from 'components/Form/Form'
import HeaderGrid from 'components/HeaderGrid'
import { connect as connectFormik, Formik } from 'formik'
import { defaultsDeep, get, groupBy, map, zipObject } from 'lodash-es'
import React, { useCallback, useEffect, useMemo, useReducer } from 'react'
import { connect } from 'react-redux'
import {
Button,
Dropdown,
FormField,
const testArr = [
/* 0 */ 0,
/* 1 */ 1,
/* 2 */ 0,
/* 3 */ -3,
/* 4 */ 1,
/* 5 */ 3,
/* 6 */ 4,
/* 7 */ 0,
/* 8 */ 1,
@MunifTanjim
MunifTanjim / str.sh
Created May 31, 2020 00:27
Shell Helpers
function str_repeat() {
local -r str="$1"
local -r n="$2"
echo "$(printf '%*s' "${n}" | tr ' ' "${str}")"
}
function str_box() {
local -r str="$1"
local -r str_len=$(( 4 + ${#str} ))
@MunifTanjim
MunifTanjim / setup-from-github-release
Created July 31, 2020 15:14
Setup from Github Release
#!/usr/bin/env bash
set -euo pipefail
command_exists() {
type "${1}" >/dev/null 2>&1
}
select_github_release() {
local -r repo="${1}"
@MunifTanjim
MunifTanjim / carbon.now.sh-gruvbox_dark.json
Created June 8, 2021 22:13
carbon.now.sh - gruvbox dark
{
"custom": true,
"id": "gruvbox_dark",
"name": "Gruvbox Dark",
"highlights": {
"attribute": "#d79921",
"background": "#1d2021",
"comment": "#a89984",
"definition": "#fbf1c7",
"keyword": "#fb4934",
@MunifTanjim
MunifTanjim / nvm.plugin.sh
Created November 21, 2021 11:16
NVM Lazy Loading
export NVM_DIR="${HOME}/.local/share/nvm"
PATH="./node_modules/.bin:${PATH}"
if [ -d "${NVM_DIR}" ]; then
__node_global_bins=("nvm" "node" $(find ${NVM_DIR}/versions/node -maxdepth 3 -path '*/bin/*' -type l -print0 2>/dev/null | xargs -0 -n1 basename | sort | uniq))
__init_nvm() {
unset -f ${__node_global_bins[@]} >/dev/null 2>&1
unset __node_global_bins
@MunifTanjim
MunifTanjim / .config--hammerspoon--.nvimrc.lua
Last active August 24, 2022 16:23
Neovim - Project Local Config with exrc.nvim
require("config.lsp.custom").patch_lsp_settings("sumneko_lua", function(settings)
settings.Lua.diagnostics.globals = { "hs", "spoon" }
settings.Lua.workspace.library = {}
local hammerspoon_emmpylua_annotations = vim.fn.expand("~/.config/hammerspoon/Spoons/EmmyLua.spoon/annotations")
if vim.fn.isdirectory(hammerspoon_emmpylua_annotations) == 1 then
table.insert(settings.Lua.workspace.library, hammerspoon_emmpylua_annotations)
end