Skip to content

Instantly share code, notes, and snippets.

Avatar

Atsushi goofmint

View GitHub Profile
@goofmint
goofmint / cmc.sh
Last active Nov 25, 2020
コマンドラインでCustomers Mail Cloudからメール送信を行うシェルスクリプト
View cmc.sh
#!/bin/bash -x
PROGNAME=$(basename $0)
VERSION='2.0'
declare -a FILES=()
usage() {
echo "Usage: $PROGNAME [OPTIONS]"
echo " This script is sending email from shell script by Customers Mail Cloud."
@goofmint
goofmint / notableToBoostnote.js
Created Aug 14, 2020
Move contents from Notable to Boostnote
View notableToBoostnote.js
const fs = require('fs');
const { promisify } = require('util');
const metadataParser = require('markdown-yaml-metadata-parser');
const baseDir = '/path/to/Notable/notes';
const outputDir = '/path/to/Boostnote';
(async () => {
const files = await promisify(fs.readdir)(baseDir);
const fileList = files.filter((file) => /.*\.md$/.test(file) && fs.statSync(`${baseDir}/${file}`).isFile());
View index.js
const a_class = ncmb.DataStore('A_class');
const b_class = ncmb.DataStore('B_class');
// ↓ ここ
ons.ready(async function() {
const result = await a_class.fetchAll();
for (let row of result) {
const result2 = await b_class
.relatedTo(row, 'tests')
.fetchAll();
objectB.push(result2.count);
@goofmint
goofmint / code.js
Created Mar 10, 2020
QualityForwardとGoogleスプレッドシートでテスト結果を可視化するサンプルコード
View code.js
function myFunction() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data")
var apiKey = sheet.getRange(1, 2).getValue();
var qf = new QualityForward.Client(apiKey);
var resultSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("TestResult")
var today = new Date;
var testPhaseId = sheet.getRange(2, 2).getValue();;
var testSuiteAssignmentId = sheet.getRange(3, 2).getValue();;
var testCycleId = sheet.getRange(4, 2).getValue();;
View index.js
async function select(category) {
myNavigator.pushPage('display.html');  //画面遷移
var LaundryData = ncmb.DataStore("LaundryData");
var currentUser = ncmb.User.getCurrentUser();
try {
// awaitに変更
var results = await LaundryData.equalTo("owner", currentUser.get("userName"))  //現在ログインしているユーザ、あてはまるカテゴリで検索
.equalTo("categoryData", category)
.order("laundryName")
.fetchAll();
View index.js
({}).constructor.name
// -> "Object"
View index.js
(function hello() {}).constructor.name
// -> "Function"
View index.js
class Hello {};
const hello = new Hello;
hello.constructor.name;
// -> "Hello"
View index.js
typeof 1
// -> "number"
typeof 0.001
// -> "number"
0.001.constructor.name
// -> "Number"
isNaN(0.001)
// -> false