Skip to content

Instantly share code, notes, and snippets.

View don4ecap's full-sized avatar
🥱
I may be slow to respond.

don4ecap

🥱
I may be slow to respond.
View GitHub Profile
@codequokka
codequokka / start-tmux-automatically-on-zsh.zsh
Last active November 22, 2024 14:07
Start tmux automatically on zsh
# Start the tmux session if not alraedy in the tmux session
if [[ ! -n $TMUX ]]; then
# Get the session IDs
session_ids="$(tmux list-sessions)"
# Create new session if no sessions exist
if [[ -z "$session_ids" ]]; then
tmux new-session
fi
const getCookieValue = (name) => document.cookie.match(new RegExp(`${name}=(.*?);`))?.[1];
// ✅ res is the the value of the cookie feature_x
const res = getCookieValue('feature_x');
@sindresorhus
sindresorhus / esm-package.md
Last active October 14, 2025 20:49
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.
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active October 9, 2025 16:35
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@odai-alali
odai-alali / js_functions_equivalent.java
Created February 22, 2018 11:12
The equivalent to a JavaScript setInterval/setTimeout in Android/Java?
// setInterval()
new Timer().scheduleAtFixedRate(new TimerTask(){
@Override
public void run(){
Log.i("interval", "This function is called every 5 seconds.");
}
},0,5000);
// setTimeout()
new android.os.Handler().postDelayed(
@peschee
peschee / git_ssl_self_signed.md
Last active October 6, 2025 15:04
Disable SSL verification in git repositories with self-signed certificates

Sometimes, we have to access git repositories over SSL and the server only provides a self-signed certificate 🙈. Although there are ways to increase the trust level for the self-signed certificate (https://confluence.atlassian.com/fishkb/unable-to-clone-git-repository-due-to-self-signed-certificate-376838977.html, https://confluence.atlassian.com/bitbucketserverkb/resolving-ssl-self-signed-certificate-errors-806029899.html), my recommendation is to just ignore SSL verification alltogether.

Prepend GIT_SSL_NO_VERIFY=true before every git command run to skip SSL verification. This is particularly useful if you haven't checked out the repository yet.

Run git config http.sslVerify false to disable SSL verification if you're working with a checked out repository already.

@bouroo
bouroo / fstab
Last active February 29, 2024 04:54
Example /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# Optimize btrfs for SSD
UUID=xxx /mount/to btrfs defaults,ssd,subvol=@ 0 1
@janily
janily / Breakpoints
Created January 16, 2014 11:36
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }