Skip to content

Instantly share code, notes, and snippets.

View Jaballadares's full-sized avatar

John Balladares Jaballadares

View GitHub Profile
@rezonn
rezonn / GASPolyfills.js
Last active January 28, 2021 04:49
Google Apps Script polyfills
function fetch(url,options2) {
if (options2) {
if (options2.body) {
options2.payload = options2.body.toString("binary");
options2.body = undefined;
}
}
return new Promise(function (resolve, reject) {
try {
var data = UrlFetchApp.fetch(url, options2);
@spencerwooo
spencerwooo / termiWidget.js
Last active September 18, 2025 05:20
🍋 TermiWidget - Terminal-like Widget for iOS 14, made with Scriptable.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: orange; icon-glyph: quote-right;
// Change these to your usernames!
const user = "spencer"
const jike = "4DDA0425-FB41-4188-89E4-952CA15E3C5E"
const telegram = "realSpencerWoo"
const github = "spencerwooo"
@kopischke
kopischke / Functions.js
Last active September 1, 2024 00:16
Code snippets for Script actions in Airtable Automations
// Utility functions for Airtable Automations
/**
* @param {string} url
* @param {Base} [forBase=base]
*/
function getTableFromURL(url, forBase) {
let root = forBase ? forBase : base
let found = url.match(/^https?:\/\/airtable.com\/(?<tableID>[^\/]+)/)
return root.getTable(found.groups.tableID)
@ex-preman
ex-preman / Code.gs
Last active April 17, 2025 02:09
CRUD Using Google Apps Script
function doGet(e) {
Logger.log(e);
var op = e.parameter.action;
var ss = SpreadsheetApp.open(DriveApp.getFileById("YOUR_SPREADSHEET_ID"));
var sn = "YOUR_SHEET_NAME";
var sheet = ss.getSheetByName(sn);
if (op == "insert")
return insert_value(e, sheet);

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@sperand-io
sperand-io / worker.js
Last active October 28, 2023 09:41
Cloudflare Workers / Segment Smart Proxy — serve data collection assets and endpoints from your own domain
/**
* Steps to use:
* 1. Create CF Worker, copy and paste this in
* 2. (Optional) Update configuration defaults
* - If you want to manage in code, do so below under "Static Configuration"
* - If you want dynamic custom config: Create CFW KV namespace, link them, and add reference below
*
* - You can overwrite default path prefix for loading analytics.js (<yourdomain>/ajs)
* (corresponding KV entry: `script_path_prefix`)
* - You can overwrite default path prefix for handling first-party data collection (<yourdomain>/data)
@akrantz
akrantz / Custom Function SUM().EXCEL.yaml
Last active April 25, 2022 08:02
Implement the SUM() function in JavaScript.
name: Custom Function SUM()
description: Implement the SUM() function in JavaScript.
host: EXCEL
api_set: {}
script:
content: |
/**
* The sum of all of the numbers.
* @customfunction
* @param number1 A number (such as 1 or 3.1415), a cell address (such as A1 or $E$11), or a range of cell addresses (such as B3:F12).
@amjad
amjad / json_sync_acf_fields.php
Last active October 1, 2021 09:42 — forked from superpositif/jp_sync_acf_fields.php
Automatically update Advanced Custom Fields field groups via JSON
<?php
/**
*
* Function that will automatically remove ACF field groups via JSON file update
*
*/
function acf_auto_suppr($json_dirs) {
$groups = acf_get_field_groups();
if (empty($groups)) {
@donmccurdy
donmccurdy / csv-processing.js
Created October 31, 2018 20:45
example CSV transformation in Node.js
const fs = require('fs')
const csv = require('csv');
fs.createReadStream('data.csv')
.pipe(csv.parse({columns: true}))
.pipe(csv.transform((input) => {
return Object.assign({}, input, {
foo: input['foo'].toUpperCase()
});
}))
@azanli
azanli / Email_Scraper.js
Last active February 6, 2024 20:45
An email scraper for websites - extracts names and emails from a page & inserts them into your Google Spreadsheet for Mail Merge
class Email_Scraper {
constructor(log = false, names = true, scriptURL = '', spreadsheetURL = '') {
this.currIndex = 0;
this.log = log;
this.names = names;
this.pendingRecursive = 1;
this.scriptURL = scriptURL;
this.spreadsheetURL = spreadsheetURL;
this.sourceIndex = 0;
this.sources = {};