Skip to content

Instantly share code, notes, and snippets.

View mcnaveen's full-sized avatar
🦄

Naveen MC mcnaveen

🦄
View GitHub Profile
@mcnaveen
mcnaveen / script.js
Last active September 3, 2024 04:50
Scroll into View after the page load in Safari
// This function ensures the current browser is Safari
// Checks if the URL has a jumplink
// If the webpage has lots of heavy images before the target section. It’s good idea to cache them with CDN or Rocketloader
window.addEventListener('load', function() {
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if (isSafari && window.location.hash) {
const element = document.querySelector(window.location.hash);
if (element) {

You are an expert AI programming assistant that primarily focuses on producing clear, readable Ruby code. You always use the latest stable version of Ruby and Rails, and you are familiar with the latest features and best practices. You also use the latest versions of Tailwind, Stimulus, Hotwire and Turbo. You carefully provide accurate, factual, thoughtful answers, and are a genius at reasoning.

  • Follow the user's requirements carefully & to the letter.
  • First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
  • Confirm, then write code!
  • Always write correct, up to date, bug free, fully functional and working, secure, performant and efficient code.
  • Theme: Light Modern
  • Icon: Material Icon theme

CleanShot 2024-08-09 at 11 52 56

<nav className="flex transition-opacity duration-150 ease-out fixed sm:top-0 max-sm:bottom-0 max-sm:dark:bg-black/60 max-sm:bg-background/50 max-sm:h-[86px] z-10 justify-center sm:justify-between max-sm:px-4 sm:flex-col sm:min-h-dvh bottom-t sm:border-r sm:w-[70px] w-full border-border">
<div className="flex sm:flex-col items-center max-sm:pb-[calc(env(safe-area-inset-bottom)/3)] max-sm:gap-6 gap-3 text-primary">
<a
href="/"
className="active:opacity-85 mt-2 mb-2 hidden sm:block group"
>
<p>Nav Item</p>
</Link>
<p>Nav Item</p>

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

const colorTableBody = document.querySelector('.color-table__body');
if (colorTableBody) {
const rows = colorTableBody.querySelectorAll('tr');
const colorNames = [];
rows.forEach(row => {
const colorNameElement = row.querySelector('.color-table__cell.color-table__cell--name');
if (colorNameElement) {
const colorName = colorNameElement.innerText;
colorNames.push(colorName);
}
@mcnaveen
mcnaveen / check_authorization.php
Created April 3, 2021 15:39 — forked from anonymous/check_authorization.php
PHP Telegram Authorization
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@mcnaveen
mcnaveen / code.js
Created September 30, 2023 17:52
Add Copy Button to Ghost P Tag
<script>
document.addEventListener("DOMContentLoaded", function () {
var paragraphs = document.querySelectorAll(".gh-content p");
paragraphs.forEach(function (paragraph) {
var copyButton = document.createElement("button");
copyButton.className = "copy-btn";
copyButton.setAttribute("data-umami-event", "Copy button");
copyButton.innerHTML = "&#x1F4CB;";
#!/bin/bash
# URL of the Android Studio download page
URL="https://developer.android.com/studio"
# CSS selector to target the element
SELECTOR="#agree-button__studio_linux_bundle_download"
# Use curl to fetch the web page content and pipe it to grep
# -s: Silent mode (suppresses progress meter)
@mcnaveen
mcnaveen / file.md
Created August 18, 2023 05:44
Use MacBook in Camshell Mode (Lid Closed) without power adapter connected

Open the terminal and run the below command

pmset -g | grep hibernatemode

Note down the number in safe place, you'll need this later if you want to disable it

Now, run the below commands one by one.