Skip to content

Instantly share code, notes, and snippets.

View jonathanzuniga's full-sized avatar
😴
I may be slow to respond

Jonathan Zúñiga jonathanzuniga

😴
I may be slow to respond
View GitHub Profile
// FROM https://gist.github.com/IkarosKappler/d3c39db08115085bcb18#file-fix_by_ikaros-js
import * as THREE from "https://cdn.skypack.dev/three";
function transformSVGPath(pathStr) {
const DIGIT_0 = 48, DIGIT_9 = 57, COMMA = 44, SPACE = 32, PERIOD = 46,
MINUS = 45;
const DEGS_TO_RADS = Math.PI/180.0;
var path = new THREE.Shape();
@jonathanzuniga
jonathanzuniga / nvmCommands.js
Created September 10, 2024 22:52 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@jonathanzuniga
jonathanzuniga / README.md
Created December 8, 2023 21:09 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@jonathanzuniga
jonathanzuniga / Download Images.gs
Created July 14, 2023 19:36 — forked from palumbo/Download Images.gs
The code I used to download images into a Google Sheets cell or download images into a Google Drive folder.
function insertImage() {
let sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let lastRow = sheet.getLastRow();
for (let i = 0; i < lastRow-1; i++) {
let url = sheet.getRange(2+i,1).getValue();
let image = SpreadsheetApp.newCellImage().setSourceUrl(url);
sheet.getRange(2+i,2).setValue(image);
}
export default class EventEmitter
{
constructor()
{
this.callbacks = {}
this.callbacks.base = {}
}
on(_names, callback)
{
@jonathanzuniga
jonathanzuniga / useScript.tsx
Created June 29, 2022 21:50 — forked from addisonschultz/useScript.tsx
A React hook that lets you add script tags to a component. Useful when needing to load scripts for components in Framer X.
import * as React from "react"
import { useState, useEffect } from "react"
// Hook
let cachedScripts = []
export function useScript(src) {
// Keeping track of script loaded and error state
const [state, setState] = useState({
loaded: false,
@jonathanzuniga
jonathanzuniga / clean_code.md
Created February 17, 2022 18:44 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@jonathanzuniga
jonathanzuniga / spiral.js
Created August 25, 2020 19:36 — forked from thaibui/spiral.js
Drawing a spiral in a square of size N in Javascript
/**
* Making a spiral of size N x N and output the drawing out to the console.
* For example, when n = 10, this is how the output spiral will look like:
* * * * * * * * *
* *
* * * * * * *
* * * *
* * * * *
* * * * * *
@jonathanzuniga
jonathanzuniga / Classes.js
Created August 7, 2020 20:04 — forked from gaearon/Classes.js
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@jonathanzuniga
jonathanzuniga / html_email_buttons_1.html
Created February 7, 2020 23:30 — forked from elidickinson/html_email_buttons_1.html
HTML email buttons that work
<div>
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.EXAMPLE.com/" style="height:40px;v-text-anchor:middle;width:300px;" arcsize="10%" stroke="f" fillcolor="#d62828">
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">
Button Text Here!
</center>
</v:roundrect>
<![endif]-->
<![if !mso]>