Skip to content

Instantly share code, notes, and snippets.

@laurenancona
laurenancona / JSON with JS.md
Created March 22, 2017 15:28
Access local JSON data with Javascript

What

An updated guide/collection of guides on how to access JSON data with JavaScript

Original Question on Stack Exchange.


Example 1

For reading the external Local JSON file (data.json) using java script

@laurenancona
laurenancona / twitterUserInfoFunctions.gs
Last active November 19, 2021 12:51
Add custom functions to a Google sheet to pull user info directly from Twitter REST API
// 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) {
@laurenancona
laurenancona / technocratic-oath.md
Last active February 19, 2021 09:52
technocratic-oath

Technocratic Oath

I swear to fulfill, to the best of my ability and judgment, this covenant:

I will respect the hard-won scientific gains of those physicians in whose steps I walk, and gladly share such knowledge as is mine with those who are to follow.

I will apply, for the benefit of the sick user, all measures which are required, avoiding those twin traps of overtreatment and therapeutic nihilism.

I will remember that there is art to medicine software as well as science, and that warmth, sympathy, and understanding may outweigh the surgeon's knife or the chemist's drug need for another dependency.

@laurenancona
laurenancona / GoogleAppsScript2GitHub.gs
Created October 26, 2017 21:05 — forked from mhawksey/GoogleAppsScript2GitHub.gs
Example script that demonstrates how you can commit files to Github using Google Apps Script. If copying into a script project remembers to add a oAuth2 library https://github.com/googlesamples/apps-script-oauth2. More info in this post https://mashe.hawksey.info/?p=17293
/*
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());
@laurenancona
laurenancona / loadtest.py
Created October 7, 2016 21:16 — forked from mjumbewu/loadtest.py
Simple load tester that continuously sends GET requests to a list of URLs for a given duration of time. Requires python libraries click and requests.
#!/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
@laurenancona
laurenancona / json-ld-gtm.html
Last active September 28, 2016 21:10 — forked from chrisgoddard/json-ld-gtm.html
JSON-LD GTM Tag
<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
@laurenancona
laurenancona / .block
Last active July 15, 2016 20:11
Brett
license: gpl-3.0
border: no
scrolling: no