Skip to content

Instantly share code, notes, and snippets.

View songwutk's full-sized avatar

songwutk

  • Phrae Hospital
  • Phrae,Thailand
View GitHub Profile
@mhawksey
mhawksey / gist:1442370
Last active February 25, 2024 12:01
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;
}
// 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';
@daichan4649
daichan4649 / convertSheet2Json.gs
Last active November 16, 2024 12:45
[GAS] load SpreadSheet as JSON #spreadsheet #calendar #google
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++) {
@james2doyle
james2doyle / simple-json-reponse.php
Last active March 7, 2024 06:02
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($code = 200, $message = null)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@Tosyn
Tosyn / phalconphp_php7_ubuntu_16_04.sh
Last active October 28, 2021 10:43
PhalconPhp with PHP7 Installation on Ubuntu 16.04
#!/bin/bash
# PhalconPhp with PHP7 installation on ubuntu:16.04
sudo apt-get update
sudo apt-get install -y php7.0-fpm \
php7.0-cli \
php7.0-curl \
php7.0-gd \
@yothinix
yothinix / init.vim
Created May 22, 2018 02:51
Yothinix's init.vim setup
if &compatible
set nocompatible
endif
set runtimepath+=/Users/man/.nvim/bundles/repos/github.com/Shougo/dein.vim
if dein#load_state('/Users/man/.nvim/bundles')
call dein#begin('/Users/man/.nvim/bundles')
call dein#add('/Users/man/.nvim/bundles/repos/github.com/Shougo/dein.vim')
@nwatab
nwatab / LINE-BOT-GAS-SAMPLE.js
Last active May 27, 2021 10:35
Supporterz 2 and 24, October, 2018
We couldn’t find that file to show.
@apivat60
apivat60 / code.gs
Last active April 6, 2021 17:31
code.gs
var SCRIPT_PROP = PropertiesService.getScriptProperties();
function setup() {
var doc = SpreadsheetApp.getActiveSpreadsheet();
SCRIPT_PROP.setProperty("//ใส ID ของชีต", doc.getId());
}
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('form.html').setTitle("ฟอร์มรับสมัครนักเรียน");
}
function onOpen() {
let ui = SpreadsheetApp.getUi()
ui.createMenu("PDF")
.addItem("สร้าง PDF", "pdfForm")
.addItem("สร้าง PDF ทั้งหมด", "pdfFormAll")
.addToUi()
}
function pdfFormAll(){
let docId = 'ID ของ Google Docs';
let sheetId = 'ID ของ Google Spreadsheet';
//พัฒนาโดยครูอภิวัฒน์ วงศ์กัณหา ช่องยูทูป "ครูอภิวัฒ์ สอนสร้างสื่อ"
var Tempfolder ;
var fileSlide ;
var copyFile;
function myFunction() {
var form = FormApp.openById('aaa'); // ***ใส่ form id***
var fRes = form.getResponses();
var fRes = fRes[fRes.length - 1];
var item = fRes.getItemResponses();