Skip to content

Instantly share code, notes, and snippets.

@snowlong
snowlong / readWriteGoogleSpreadSheet.js
Created June 19, 2020 10:55
Googleスプレッドシートを開く>シートを指定する>データの範囲を取得する>最終行の次からデータを書き込む
function myFunction() {
// スプレッドシートURL
var sheetURL = 'スプレッドシートURL';
// 書き込み先のシート
var sheetName = 'シート1';
//スプレッドシートを開いて、シートを指定する
var ss = SpreadsheetApp.openByUrl(sheetURL);
var sheet = ss.getSheetByName(sheetName);
javascript:(function(){const aNodeList=document.querySelectorAll('a');[].forEach.call(aNodeList,function(element,index){const div=document.createElement('div');div.innerHTML=element.getAttribute('href');div.style.color='#000';div.style.fontWeight='bold';div.style.borderStyle='solid';div.style.borderWidth='2px';div.style.borderColor='#000';div.style.padding='10px';div.style.background='yellow';div.style.fontSize='15px';div.style.position='absolute';div.style.zIndex='99999';div.style.display='block';element.parentNode.insertBefore(div,element.nextSibling)})})();
const aNodeList = document.querySelectorAll('a');
[].forEach.call(aNodeList, function(element, index) {
const div = document.createElement('div');
div.innerHTML = element.getAttribute('href');
div.style.color = '#000';
div.style.fontWeight = 'bold';
div.style.borderStyle = 'solid';
div.style.borderWidth = '2px';
div.style.borderColor = '#000';
@snowlong
snowlong / sleep.js
Created November 10, 2017 02:42
Even Javascript wants to sleep.
function sleep(time) {
const d1 = new Date();
while (true) {
const d2 = new Date();
if (d2 - d1 > time) {
return;
}
}
}
@snowlong
snowlong / move_focus_entar.js
Created November 29, 2016 10:01
[Form] Move the focus with the Enter key
// http://blog.makotoishida.com/2013/02/javascript-enter.html
var elements = "input";
$(elements).on('keypress', function(e) {
var c = e.which ? e.which : e.keyCode;
if (c == 13) {
var index = $(elements).index(this);
$(elements + ":gt(" + index + "):first").focus();
e.preventDefault();
}
});
@snowlong
snowlong / onload.html
Created August 1, 2016 03:53
onload Event Example
<!DOCTYPE html>
<html>
<body>
<p>See: http://www.w3schools.com/jsref/event_onload.asp</p>
<img src="w3javascript.gif" onload="loadImage()" width="100" height="132">
<script>
function loadImage() {
alert("Image is loaded");
}
var gulp = require('gulp');
var mocha = require('gulp-mocha');
gulp.task('watch', function(){
gulp.watch(['./test/test.js'], ['mocha']);
});
gulp.task('mocha', function(){
gulp.src('./test/test.js')
.pipe(mocha());
@snowlong
snowlong / install_mocha_and_power-assert.sh
Last active July 28, 2016 07:23
Install mocha and power-assert for gulp
npm install gulp-mocha --save-dev
npm install intelli-espower-loader --save-dev
npm install power-assert --save-dev
@snowlong
snowlong / index.html
Created June 22, 2016 11:04
No telephone link.
<p class="tel" x-ms-format-detection="none">XXX-XXXX-XXXX</p>
// For Text
javascript:prompt('Title%20+%20URL',document.title+'%5Cn'+location.href)();
// For Markdown
javascript:prompt('Title%20+%20URL%20For%20Markdown','['+document.title+']'+'('+location.href+')')();
// For Hatena Blog embed
javascript:prompt('URL%20ForHatena%20Blog%20embed','['+location.href+':embed]')();
// For Hatena Blog embed and cite
javascript:prompt('URL%20ForHatena%20Blog%20embed%20and%20cite','['+location.href+':embed:cite]')();