Skip to content

Instantly share code, notes, and snippets.

@rramona2
rramona2 / Google-Sheet-Form-Post.md
Created August 12, 2019 14:23 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

@rramona2
rramona2 / wc-add-message-login-form.php
Created July 16, 2019 16:02 — forked from woogists/wc-add-message-login-form.php
[Frontend Snippets] Add a message above the login / register form
/**
* Add a message above the login / register form on my-account page
*/
add_action( 'woocommerce_before_customer_login_form', 'jk_login_message' );
function jk_login_message() {
if ( get_option( 'woocommerce_enable_myaccount_registration' ) == 'yes' ) {
?>
<div class="woocommerce-info">
<p><?php _e( 'Returning customers login. New users register for next time so you can:' ); ?></p>
<ul>
@rramona2
rramona2 / bootstrap_stripejs_bank.html
Created February 11, 2019 08:47 — forked from adamjstevenson/bootstrap_stripejs_bank.html
Stripe.js Bootstrap bank account form
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Stripe.js example bank account form</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>A Bootstrap Stripe.js bank account form</h1>
@rramona2
rramona2 / google-apps-script.md
Created February 10, 2019 09:51 — forked from labnol/google-apps-script.md
The best resources for learning Google Apps Script, the glue that connects GSuite services including Gmail, Google Drive, Calendar, Maps, Analytics and more.

Learning Google Apps Script

The best resource for learning Google Script is the official documentation available at developers.google.com. Here are other places that will help you get up to speed.

  1. Google Apps Scripts - Snippets by +Amit Agarwal
  2. Apps Script Starter - Modern development workflow for building Google Apps Script projects with Babel, Webpack and VS Code.
  3. Digital Inspiration by +Amit Agarwal - Google Addons
  4. Awesome Google Scripts by +Amit Agarwal
  5. O'Reilly - Apps Script - by +James Ferreira
  6. Apps Script Webinars - YouTube - by +Eric Koleda
@rramona2
rramona2 / gas_qbo_oauth2.js
Created January 27, 2019 11:50 — forked from goelp/gas_qbo_oauth2.js
Google Apps Script OAuth2 script for QuickBooks integration with Google Sheets
var CLIENT_ID = '...'; // Get from Quickbooks Developer Console
var CLIENT_SECRET = '...'; // Get from Quickbooks Developer Console
var BASE_AUTH_URL = 'https://appcenter.intuit.com/connect/oauth2';
var TOKEN_URL = 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer';
var API_SCOPE = 'com.intuit.quickbooks.accounting';
var REDIRECT_URI = '...'; // Generate using the logRedirectUri() function mentioned at the end of this script
var RESPONSE_TYPE = 'code';
/**
* Authorizes and makes a request to the Quickbooks API using OAuth 2.
@rramona2
rramona2 / zapier-bigquery.js
Created January 2, 2019 00:16 — forked from jdanbrown/zapier-bigquery.js
Custom Zapier app for BigQuery
/*
1. Account -> Developers -> new app
2. Authentication: use "Unknown Auth", then manually adds fields `service_account_email` and `service_account_private_key_json`
- Auth is done manually via service account key in the js below
3. Triggers: add triggers with specific keys and fields to match the custom js code below, which overrides their behavior
- Create a "polling" trigger with key `test_trigger`, with field `project`
- Create a "polling" trigger with key `new_row`, with fields `project` and `query`
- Create a "polling" trigger with key `table_modified`, with fields `project`, `dataset`, and `table`
4. Scripting API: paste in this whole file as is
SELECT pages.pageid, url, cnt, libs, pages.rank rank FROM [httparchive:runs.2013_06_01_pages] as pages JOIN (
SELECT pageid, count(distinct(type)) cnt, GROUP_CONCAT(type) libs FROM (
SELECT REGEXP_EXTRACT(url, r'(dojo|angular|prototype|backbone|emberjs|sencha|scriptaculous).*\.js') type, pageid
FROM [httparchive:runs.2013_06_01_requests]
WHERE REGEXP_MATCH(url, r'dojo|angular|prototype|backbone|emberjs|sencha|scriptaculous.*\.js')
GROUP BY pageid, type
)
GROUP BY pageid
HAVING cnt >= 2
) as lib ON lib.pageid = pages.pageid
@rramona2
rramona2 / drive-appscript.js
Last active June 29, 2018 21:47 — forked from igrigorik/drive-appscript.js
Sample BigQuery queries for the HTTP Archive dataset.
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Run Query", functionName: "runQuery"} ];
ss.addMenu("HTTP Archive + BigQuery", menuEntries);
}
function runQuery() {
var projectNumber = 'httparchive';
var sheet = SpreadsheetApp.getActiveSheet();
@rramona2
rramona2 / OAuth2.0.js
Created February 25, 2018 11:33 — forked from bduerst/OAuth2.0.js
This is a Google Apps Script (or Adwords Scripty) set of Oauth 2.0 Functions. The idea is that you can use this to start the OAuth 2.0 flow and to get tokens, using only Google App Scripts and Drive (to store the tokens).
// Script for handling OAuth2.0 with AdWords Scripty
// Uses Google Drive as a database to store tokens
/*
Set the script variables below, using authentication for a web client from google project console
Create two empty text files on Drive, get their file IDs and enter as variables below
Follow the steps in firstRun function, starting with step 1
For the uninitiated, the flow for OAuth2.0 is as follows:
1) Generate the URL to request access from Google
@rramona2
rramona2 / index.js
Created February 25, 2018 11:32 — forked from pepetox/index.js
Google Cloud Function to publish data in pub/sub and from pub/sub to Big query
//gcloud beta functions deploy --trigger-topic data --stage-bucket XXXXXXX-ml-mlengine --project XXXXXX subscribeDataFlow
//gcloud beta functions deploy --trigger-http --stage-bucket XXXXXXX-ml-mlengine --project XXXXXX publishData
var pubsub = require('@google-cloud/pubsub')();
const bigquery = require('@google-cloud/bigquery')();
exports.publishData = function(req, res) {
var topic = pubsub.topic('data');
var publisher = topic.publisher();