Skip to content

Instantly share code, notes, and snippets.

View mheob's full-sized avatar
🚀
AWESOME 🤘

Alex Böhm mheob

🚀
AWESOME 🤘
View GitHub Profile
@mjbalcueva
mjbalcueva / calendar.tsx
Last active November 18, 2024 00:48
shadcn ui calendar custom year and month dropdown
"use client"
import * as React from "react"
import { buttonVariants } from "@/components/ui/button"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "@/lib/utils"
import { ChevronLeft, ChevronRight } from "lucide-react"
import { DayPicker, DropdownProps } from "react-day-picker"
@mheob
mheob / brew-bundle-brewfile-tips.md
Created November 22, 2022 16:08 — forked from ChristopherA/brew-bundle-brewfile-tips.md
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@mheob
mheob / helpful-snippets.js
Last active September 1, 2022 13:50
JS - Helpful Snippets
// Detect if dark mode
const isDarkMode = () => globalThis.matchMedia?.("(prefers-color-scheme:dark)").matches ?? false;
isDarkMode();
// ---------------------------------------------------------------
@mheob
mheob / use-toggle.ts
Created October 19, 2021 07:55
Simple `useToggle` hook which returns the boolean state and the setter methods `on`, `off`, `toggle` and `reset`.
import { useState } from 'react'
export function useToggle(
initialState = false
): [boolean, { on: () => void; off: () => void; toggle: () => void; reset: () => void }] {
const [state, setState] = useState(initialState)
const handlers = {
on: () => {
setState(true)
},
@sindresorhus
sindresorhus / esm-package.md
Last active November 17, 2024 22:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@mheob
mheob / post-merge.sh
Created February 8, 2021 15:46
100HERZ - Craft CMS - Git Hook - post merge
#!/usr/bin/env bash
# git hook to run a command after `git pull` if a specified file was changed
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
echo "Checking yarn.lock ..."
@apurvajain
apurvajain / Commit_Message.md
Last active August 15, 2023 21:14
Commit Message Template

Commit Message Convention

type(scope): subject 

<body>
<footer>

1. Type of commit

How I Update Craft CMS 3.5.x and Craft CMS Plugins

⏳ 2 min read.

Update apnea: the temporary cessation of breath when updating Craft and Craft plugins.

This article describes the steps I follow to update Craft 3.5.x and plugins in a stress-free and reliable manner. 🧘

Photo of blue and pink sea by Harli Marten Photo by Harli Marten on Unsplash

@mheob
mheob / jsx.yaml
Last active February 8, 2021 15:48
Simple (plain) JSX and TSX syntax for the micro editor https://github.com/zyedidia/micro
# ~/.config/micro/syntax/jsx.yaml
filetype: jsx
detect:
filename: "\\.jsx$"
rules:
- include: "javascript"
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active November 18, 2024 14:50
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.