Skip to content

Instantly share code, notes, and snippets.

🐣
in progress of growing

Sota Sugiura sota1235

🐣
in progress of growing
  • Mercari, Inc.
  • Yokohama
Block or report user

Report or block sota1235

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.js
// Usage:
// node index.js ${input} ${output}
// Require:
// Node.js
// ffmpeg
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execSync;
const originDir = process.argv[2];
View index.js
class Result {
constructor(answers) {
this.answers = answers;
}
score() {
let result = 0;
this.answers.forEach((answer) => {
question = answer.question;
View README.md

Command

node --inspect index.js
View promise-asyncawait.js
/** async functionの話 */
// いつものPromise
const a = () => {
return new Promise((resolve, reject) => {
resolve(1);
});
};
// async function
const b = async () => {
View bookmarklet
javascript:(()=>{let getLfURLCode=()=>"\n";let hostname="https://scrapbox.io";let apiURI="/api/pages/:projectName/:pageTitle";let pathname=location.pathname;let[projectName,pageTitle]=pathname.substring(1).split("/");let targetURI=apiURI.replace(":projectName",projectName).replace(":pageTitle",pageTitle);let requestURL=targetURI;let request=new Request(requestURL);let myInit={method:"GET",credentials:"same-origin"};let checkContainsKeyword=body=>{return/#テンプレート|\[テンプレート\]/.test(body)};let openNewPage=(title,body)=>{const encodedBody=encodeURIComponent(body);window.open(`${hostname}/${projectName}/${title}?body=${encodedBody}`)};fetch(request,myInit).then(res=>{if(!res.ok){throw res}return res.json()}).then(data=>{let body="";data.lines.shift();data.lines.forEach(({text:text})=>{body+=text+getLfURLCode()});console.log(body);if(!checkContainsKeyword(body)){alert("テンプレートタグがページに存在しません");throw new Error("Target tag not found")}const newPageTitle=prompt("作成したいページ名を入力してください");openNewPage(newPageTitle,body)}).catch(e
View index.js
// Please pass `names` and `foods` from Zapier
// If you want to filter by food name, plz pass `specificFood` from Zapier
const names = inputData.names;
const foods = inputData.foods;
const specificFood = inputData.specificFood;
const delimitor = ','; // If you want to change delimiter, fix this line
const nameList = names.split(delimitor);
const foodList = names.split(delimitor);
View Makefile
blackfire/prepare:
wget -O - https://packagecloud.io/gpg.key | sudo apt-key add -
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list
sudo apt-get update
blackfire/agent:
sudo apt-get install blackfire-agent
sudo blackfire-agent -register
blackfire/start:
View generate.php
<?php
$pre = 'pap';
$end = 'x';
$repeat = 'i';
$count = 20;
$caces = [];
@sota1235
sota1235 / simple-di-container.js
Last active Jun 24, 2017
Simple DI Container with flow
View simple-di-container.js
/**
* @flow
* @fileoverview Container for getting instance.
*/
type InstanceInfo = {
strict: boolean,
closuer: Function,
};
type RegistedInstance = {
@sota1235
sota1235 / main.php
Created Dec 24, 2016
PHP validater for ISO8061 and more.
View main.php
<?php
echo 'test';
You can’t perform that action at this time.