Skip to content

Instantly share code, notes, and snippets.

View ManasMadrecha's full-sized avatar

CA Manas Madrecha ManasMadrecha

View GitHub Profile
@serpro69
serpro69 / canvas_diamond.css
Created September 6, 2023 12:02
obsidian canvas diamond shape
.canvas-node-container:has(.diamond) {
transform:rotate(42deg);
overflow: visible;
contain: none;
position: absolute;
width: 150px;
height: 150px;
}
.canvas-node-content:has(.diamond) {
@srhyne
srhyne / migrate-index.sh
Created March 30, 2023 19:25
Fix Cloudflare 308 trailing comma redrect issue
# Fix Cloudflare 308 trailing comma redrect issue
# https://community.cloudflare.com/t/cloudflare-pages-get-rid-of-redundat-308-redirect/324582/29
# https://electricui.com/blog/switching-to-cloudflare-pages#how-to-disable-the-trailing-slash-on-cloudflare-pages
find ./dist -name 'index.html' -mindepth 2 -type f \
-exec sh \
-c 'parent="$(dirname "$1")"; mv "$1" "$parent/../$(basename "$parent").html";' \
find-sh {} \;
@basilioss
basilioss / imdb-frontmatter.js
Last active December 9, 2022 18:34
This is an Obsidian Templater script that generates frontmatter from IMDb link
---<%*
// v1.3: Fix error if imdbRating is undefined
// Get page source
let url = await tp.system.clipboard()
url = url.replace(/\?.*$/g,"") // remove unnecessary part after '?'
let page = await tp.obsidian.request({url})
let p = new DOMParser()
let doc = p.parseFromString(page, "text/html")
// Aliases for querySelector
@danielroe
danielroe / settings.json
Last active September 13, 2024 15:01
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@kepano
kepano / obsidian-web-clipper.js
Last active September 20, 2024 14:51
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@markelliot
markelliot / getGoogleAuthToken.js
Last active June 19, 2024 16:40
Converts Google service user OAuth2 credentials into an access token in Cloudflare-compatible JS
/**
* Get a Google auth token given service user credentials. This function
* is a very slightly modified version of the one found at
* https://community.cloudflare.com/t/example-google-oauth-2-0-for-service-accounts-using-cf-worker/258220
*
* @param {string} user the service user identity, typically of the
* form [user]@[project].iam.gserviceaccount.com
* @param {string} key the private key corresponding to user
* @param {string} scope the scopes to request for this token, a
* listing of available scopes is provided at
@AnalyzePlatypus
AnalyzePlatypus / lambda-gmail-compose.md
Created May 13, 2020 08:11
Use serverless function to send low-volume emails without 3rd party mail services.

Sending email with serverless functions

You can deploy this function on any of the serverless platforms - AWS Lambda, Google Cloud Functions, Azure Functions, Netlify, Cloudflare Workers, etc.

  1. Create a new function and paste in the following code.
  2. You will need to add nodemailer to your package.json (npm i nodemailer), and follow your platform's instructions on bundling dependencies.
  3. Obtain Gmail API credentials for your account. You will need clientID, clientSecret, and refreshToken. Follow this YouTube tutorial
  4. Expose these credentials as the follwing environment variables:
GMAIL_EMAIL_ADDRESS
@WesThorburn
WesThorburn / instructions.md
Last active December 25, 2023 12:05
Use Chart.js with Nuxt v2.11.0

Use Chart.js with Nuxt v2.11.0

Line chart example

  • Run npm i vue-chartjs
  • Run npm i chart.js hchs-vue-charts
  • Create a file called chart.js and save it in the /plugins directory
  • Give chart.js the following contents
import Vue from 'vue'
import { Line } from 'vue-chartjs'
@rashid327
rashid327 / states-of-india
Last active April 19, 2024 15:59
Indian States dropdown HTML
<!-- States of India -->
<select>
<option value="AP">Andhra Pradesh</option>
<option value="AR">Arunachal Pradesh</option>
<option value="AS">Assam</option>
<option value="BR">Bihar</option>
<option value="CT">Chhattisgarh</option>
<option value="GA">Gujarat</option>
<option value="HR">Haryana</option>
@Merott
Merott / tailwind-colors-as-css-variables.md
Last active September 20, 2024 07:10
Expose Tailwind colors as CSS custom properties (variables)

This is a simple Tailwind plugin to expose all of Tailwind's colors, including any custom ones, as custom css properties on the :root element.

There are a couple of main reasons this is helpful:

  • You can reference all of Tailwind's colors—including any custom ones you define—from handwritten CSS code.
  • You can define all of your colors within the Tailwind configuration, and access the final values programmatically, which isn't possible if you did it the other way around: referencing custom CSS variables (defined in CSS code) from your Tailwind config.

See the Tailwind Plugins for more info on plugins.