Skip to content

Instantly share code, notes, and snippets.

View niyata's full-sized avatar

iWorn Studio niyata

View GitHub Profile
@niyata
niyata / code.gs
Created January 31, 2020 09:25 — forked from bennettscience/code.gs
Auto-tweet images of slides as a Google Slideshow is presented
// The rest of the backend code.
// postTweet.gs and getThumbnails.gs can be appended to this file.
// When combined, click Publish > Deploy as web app
// You can then test by visiting your app page.
var KEY = "YOUR_APP_KEY";
var SECRET = "YOUR_APP_SECRET";
// Initialize Twitter login
// See https://mashe.hawksey.info/2014/10/twtrservice-a-twitter-api-client-for-google-apps-script/
@niyata
niyata / main.gs
Created October 25, 2019 08:18
spreadsheet -> google calendar へ一括登録
var URL_BOOK = '[spreadsheet URL]';
var SHEETNAME = '[sheet name]';
var CALENDAR_ID = '[calendar id]';
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('管理者用')
.addItem('カレンダーへ登録', 'register')
.addToUi();
}
@niyata
niyata / convertSheet2Json.gs
Created October 25, 2019 07:44 — forked from daichan4649/convertSheet2Json.gs
spreadsheet のデータを JSON として読み込む(Google Apps Script)
function convertSheet2Json(sheet) {
// first line(title)
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];
// after the second line(data)
var lastRow = sheet.getLastRow();
var rowValues = [];
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) {
/* start new bbpress */
.bbp-topic-voice-count {
display: none;
}
.bbp-topic-reply-count {
color: #aaa;
font-size: 80%;
margin-right: 20px !important;
width: inherit !important;
@niyata
niyata / sync.js
Created October 17, 2019 09:09 — forked from swh/sync.js
Spreadsheet / Calendar syncing in Google Apps
/* Gobal settings */
var calId = "YOUR_CALENDAR_ID";
var alertEmail = 'YOUR_EMAIL_ADDRESS';
var sheetName = 'Holiday';
/*
* FIXME: handle rows being deleted from the spreadsheet - right now they will
* stay in the calendar if that happens
*/
@niyata
niyata / gist:34cbefc72347ee41570e9eba23784b33
Created September 30, 2019 15:26 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@niyata
niyata / Google-Sheet-Form-Post.md
Created August 24, 2019 10:06 — 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

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@niyata
niyata / gcal_chk.rb
Last active August 16, 2019 07:58 — forked from kivanio/gcal_chk.rb
ส่งข้อมูล Google Calendar โดยใช้ LINE BOT API
# coding: utf-8
require 'rest-client'
require 'json'
require 'date'
require 'gmail'
require 'yaml'
# google-api-client ต้องการ v0.6.4
require "google/api_client"
@niyata
niyata / linebot.js
Created August 12, 2019 18:05 — forked from nwatab/linebot.js
CRUD-operation-in-google-app-script-with-LINE-bot
var CHANNEL_ACCESS_TOKEN = 'xxx=';
var line_endpoint = 'https://api.line.me/v2/bot/message/reply';
function doGet(e) {
return ContentService.createTextOutput(UrlFetchApp.fetch("http://ip-api.com/json"));
}
function doPost(e) {
var contents = JSON.parse(e.postData.contents);