Skip to content

Instantly share code, notes, and snippets.

@mjbalcueva
mjbalcueva / password-input.tsx
Last active April 18, 2024 19:05
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
@Reacoder
Reacoder / edittext.java
Created August 5, 2014 05:27
EditText onClick event is not triggering
When a user interacts with a UI element the various listeners are called in a top down order. (For example: OnTouch -> OnFocusChange -> OnClick.) If a listener has been defined (with setOn...Listener) and it consumes this event: the lower priority listeners will not be called. By its nature the first time you touch an EditText it receives focus with OnFocusChangeListener so that the user can type. The action is consumed here therefor OnClick is not called. Each successive touch doesn't change the focus so the event trickles down to the OnClickListener.
Basically, you have three choices:
Set the focusable attribute to false in your XML:
android:focusable="false"
Now the OnClickListener will fire every time it is clicked. But this makes the EditText useless since the user can no longer enter any text...
Implement an OnFocusChangeListener along with the OnClickListener:
easyweb-italia
4764fbb159e067e22458285444e844c313f26d6d
@RednibCoding
RednibCoding / 0 Odin debugging on windows.md
Last active April 18, 2024 19:04
Odin debugging on windows with vscode. See: readme

To setup debugging for Odin programs on Windows with VsCode follow these steps:

  • make sure you have the C/C++ extension pack (VsCode extension) installed
  • create a .vscode folder at the root of your Odin project
  • copy the launch.json and tasks.json into it
  • click on the debug tab in VsCode, then click on the debug button at the top (or press F5)
@vlas-voloshin
vlas-voloshin / delete-duplicate-sims.rb
Last active April 18, 2024 19:04
Script for deleting duplicate iOS simulators and fixing simulators list in Xcode
#!/usr/bin/env ruby
# What is this for?
# This script fixes an issue appeared for some Xcode users where it would show long identifiers
# in the list of simulators instead of usual short names. This is caused by duplicate simulators
# being sometimes created after switching between Xcode versions, with the same
# device type + runtime pair occurring more than once in your list of available simulators.
# Instead of showing the same simulator name twice, Xcode defaults to simulator identifiers.
#
# What it does?
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 18, 2024 19:04
set -e, -u, -o, -x pipefail explanation
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active April 18, 2024 19:01
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@expersso
expersso / extracting_html_table_w_attr.R
Last active April 18, 2024 19:01
Extracting HTML tables and arbitrary HTML attributes
# SPECIFIC PROBLEM: Extract an html table and include all links
# (even when there are no links or multiple links per cell)
#
# GENERAL PROBLEM: Extract an html table and include all attributes
# for any given tag and attribute
#
# Example usage at bottom of the page
#
# Motivation: https://twitter.com/daattali/status/717582654476914688
@parmentf
parmentf / GitCommitEmoji.md
Last active April 18, 2024 19:01
Git Commit message Emoji
@mjnaderi
mjnaderi / install-arch.md
Last active April 18, 2024 19:00 — forked from mattiaslundberg/arch-linux-install
Installing Arch Linux with Full Disk Encryption (LVM on LUKS)

Installing Arch Linux with Full Disk Encryption

If you're aiming for a seamless Arch Linux installation in UEFI mode, follow along as this guide will walk you through the process step by step. We'll be using LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) partitions on LUKS to achieve full disk encryption.

Note: I have updated this doc for UEFI mode. For those with BIOS/MBR systems, you can refer to the previous version, but keep in mind that it might be outdated and no longer accurate.

If you're only interested in installing Linux and not setting up dual boot with Windows, feel free to skip the Windows-related sections.