Skip to content

Instantly share code, notes, and snippets.

@show-maeda
show-maeda / file0.txt
Created July 25, 2018 14:06
【GoogleMaps APIを使わずに!!】GASで住所から各種情報を取得するTips ref: https://qiita.com/s_maeda_fukui/items/eecca243030617c40a7b
function sample_geocoder () {
const address = SpreadsheetApp.getActiveSheet().getRange(1,1).getValue();
var
geocoder = Maps.newGeocoder() // Creates a new Geocoder object.
, geocoder = geocoder.setLanguage('ja') // Use Japanese
, response = geocoder.geocode(address).results[0]; // ets the approximate geographic points for a given address.
Logger.log(response);
}// function sample_geocoder
@show-maeda
show-maeda / file0.txt
Created May 9, 2018 11:29
[PosgreSQL][Presto]MAX_BY(MIN_BY)がpostgreで使えなくて困った話 ref: https://qiita.com/s_maeda_fukui/items/43bf7494ce6e47b8b078
select
user.id
, max_by( log.url, td_time_parse( log.created_at ) ) as url
from
user
left outer join
log
on user.id = log.user_id
group by
user.id
@show-maeda
show-maeda / file0.txt
Created April 26, 2018 13:23
[GAS]スクリプトのエラーを管理画面で確認しよう!という話 ref: https://qiita.com/s_maeda_fukui/items/297244265f2c9caa5d78
function measuringExecutionTime() {
// A simple INFO log message, using sprintf() formatting.
// 懐かしの printf と同じ感じ %s → 'myFn\unction' %d → 1 が入っている。
console.info('Timing the %s function (%d arguments)', 'myFunction', 1);
// Log a JSON object at a DEBUG level. The log is labeled
// with the message string in the log viewer, and the JSON content
// is displayed in the expanded log structure under "structPayload".
var parameters = {
isValid: true,
@show-maeda
show-maeda / file0.txt
Last active April 25, 2018 23:26
[SQL]インデントを正しく効果的に使おう ref: https://qiita.com/s_maeda_fukui/items/11c44206c69bc2780797
select
salses.id, sales.name, companies.name, sales_contact.mail
from
sales
left outer join sales_contact on sales.id = sales_contact.sales_id
left outer join sales_belonging on sales.id = sales_belonging.sales_id
left outer join companies on sales_belonging.company_id = companies.id
where
(sales.age > 20
or
@show-maeda
show-maeda / file0.txt
Created April 23, 2018 09:26
[GAS]RocketChatへのPOSTがうまくいかなくなった話 ref: https://qiita.com/s_maeda_fukui/items/b39bcb6f038eba1b6d1a
// ロケチャ送信用関数
function send_rocketchat(
text
){
res
= UrlFetchApp
.fetch(
"https://chat.leverages.jp/hooks/Pi8sjveH3qYu8FeLx/mEB4kng92jPBhRLzCwjPYbD8gi2bYAtNcSYiAhwHavPJBACu"
, {
"payload" : JSON.stringify({
@show-maeda
show-maeda / file0.txt
Created April 19, 2018 12:35
[Presto] Key-Vlue形式でクエリ結果を吐き出してみた話 ref: https://qiita.com/s_maeda_fukui/items/3e2c548bb9ec851a4a75
select
map(
array['pref_id','pref_name']
, array[cast(id as varchar), name]
)
from
pref