An updated guide/collection of guides on how to access JSON data with JavaScript
Original Question on Stack Exchange.
For reading the external Local JSON file (data.json) using java script
/* | |
To use you need to create an application on Github at https://github.com/settings/developers | |
The callback in this needs to be set to https://script.google.com/macros/d/{SCRIPT ID}/usercallback | |
Where {SCRIPT ID} is the ID of the script that is using this library. You can find your script's ID in the Apps Script code editor by clicking on the menu item "File > Project properties". | |
In this example code I've stored the apllicaitons clientId and clientSecret in the Script Properties: | |
- git_clientId | |
- git_clientSecret |
Agent.receive = function() { | |
var self = this; | |
var events = this.incomingEvents(); | |
// emailPattern from http://stackoverflow.com/a/1373724/123776 | |
var emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/gi; | |
events.forEach(function(event) { | |
event.payload['q3_whatWould'] = event.payload['q3_whatWould'].replace(emailPattern, '***@***.***'); |
<!-- Frustrated.js by Isis Anchalee @isisAnchalee | |
https://github.com/isisAnchalee/Frustrated.js --> | |
<script async='true'> | |
(function () { | |
var eventsArr = []; | |
document.addEventListener("click", function(even) { | |
eventsArr.push(new Date()); |
An updated guide/collection of guides on how to access JSON data with JavaScript
Original Question on Stack Exchange.
For reading the external Local JSON file (data.json) using java script
// Based on script by @SarahMarshall here: | |
// http://sarahmarshall.io/post/70812214349/how-to-add-twitter-follower-counts-to-a-google | |
var id = '@username'; // Replace with your username, then delete this line after running script 1st time | |
var CONSUMER_KEY = 'INSERT CONSUMER KEY'; // Create an application at https://dev.twitter.com | |
var CONSUMER_SECRET = 'INSERT CONSUMER SECRET'; // Create an application at https://dev.twitter.com | |
function getTwitterUserFollowers(id) { |
#!/usr/bin/env python | |
from __future__ import print_function, division | |
import click | |
import csv | |
from datetime import timedelta | |
from itertools import cycle | |
from queue import Queue | |
import requests |
<script> | |
(function(){ | |
var data = { | |
"@context": "http://schema.org", | |
"@type": "BlogPosting", | |
"mainEntityOfPage": { | |
"@type": "WebPage", | |
"@id": {{Page URL}} | |
}, | |
"headline": {{SCHEMA - Article Headline}}, |
{ | |
"version": 8, | |
"name": "Dark", | |
"metadata": { | |
"mapbox:autocomposite": true, | |
"mapbox:type": "default", | |
"mapbox:groups": { | |
"1444934828655.3389": { | |
"name": "Aeroways", | |
"collapsed": true |
license: gpl-3.0 | |
border: no | |
scrolling: no |
license: gpl-3.0 | |
height: 2910 | |
border: no |