Skip to content

Instantly share code, notes, and snippets.

View shinriyo's full-sized avatar

shinriyo shinriyo

View GitHub Profile
@shinriyo
shinriyo / user.onUpdate.ts
Created July 24, 2020 09:39
Sync Document for update (AddSearch with Firestore, Functions, TypeScript)
import { index, baseURL, siteKey, secretKey } from './index';
import * as functions from 'firebase-functions'
export const userOnUpdateForAddSearch = functions.firestore
.document('users/{userId}')
.onUpdate(async (event, context) => {
const axios = require('axios');
// const oldData = event.before.data();
const newData = event.after.data();
const documentId = event.after.id;
@shinriyo
shinriyo / user.onDelete.ts
Last active July 24, 2020 09:30
Sync Document for delete (AddSearch with Firestore, Functions, TypeScript)
import { index, baseURL, siteKey, secretKey } from './index';
import * as functions from 'firebase-functions'
export const userOnDeleteForAddSearch = functions.firestore
.document('users/{userId}')
.onDelete(async (event, context) => {
const axios = require('axios');
const documentId = event.id;
// needless
@shinriyo
shinriyo / user.onCreate.ts
Last active July 24, 2020 09:22
Sync Document for create (AddSearch with Firestore, Functions, TypeScript)
export const userOnCreateForAddSearch = functions.firestore
.document('users/{userId}')
.onCreate(async (snap, context) => {
const axios = require('axios');
const data = snap.data();
const objectID = snap.id;
/*const args = {
data: { objectID: objectID, ...data },
headers: { "Content-Type": "application/json" }
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
void test() {
RegExp regExp = RegExp(
r'(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?
@shinriyo
shinriyo / paintSVG.ts
Created September 28, 2018 07:33
SVGで色を無理やり付ける(IE, Edge) TypeScript
/**
* SVGで色を無理やり付ける(IE, Edge).
*
* @param {*} name
* @param {*} elem
* @param {*} fillColor
* @returns {void}
*/
export const paintSVG = (name: string, elem: any, fillColor: any): void => {
let a = '99';
@shinriyo
shinriyo / univ.sh
Created July 31, 2018 01:48
東京医科歯科大学と東京医科大学と東京歯科大学全てにマッチするbash正規表現
#!/bin/bash
univ="東京医科歯科大学"
if [[ ${univ} =~ ^東京(医科)?(歯科)?大学$ ]]; then
all=${BASH_REMATCH[0]}
echo part1. ${all}
fi
univ="東京医科大学"
@shinriyo
shinriyo / hoge.html
Last active July 27, 2018 02:40
いろんなフォント
<html>
<head>
<meta charset="utf-8">
<style>
body,div,table,thead,tbody,tfoot,tr,th,td,p { font-size:small; padding:0 }
body,div,table,thead,tbody,tfoot,tr,th,td,p {
line-height: 1;
/*font-family: 'Hiragino Kaku Gothic Pro', 'ヒラギノ角ゴ Pro W3', Meiryo, メイリオ, Osaka, 'MS PGothic', arial, helvetica, sans-serif;*/
}
@shinriyo
shinriyo / app.js
Created September 4, 2016 01:04
これをコピペで使う
import React from 'react'
import { render } from 'react-dom'
import { hashHistory, Router, Route, Link, browserHistory } from 'react-router'
var IndexRoute = Router.IndexRoute;
var Index = React.createClass({
render: function () {
return (
<div>
@shinriyo
shinriyo / LocalizeSetting.cs
Created August 11, 2016 11:14
Xamarinローカライズのメモメソッド
/// <summary>
/// Creates the localize.
/// </summary>
/// <param name="layout">Layout.</param>
public void CreateLocalize(StackLayout layout)
{
// TODO: ローカライズ.
var selectTitle = "言語選択";
var label = new Label()
@shinriyo
shinriyo / keybinding.json
Last active June 25, 2016 06:56
MonoDevelopに慣れた人のVisual Studio Codeのkeybinding.jsonを晒すぜ
// Place your key bindings in this file to overwrite the defaults
[{
"key": "shift+alt+l",
"command": "editor.action.format"
},{
"key": "shift+cmd+r",
"command": "editor.action.referenceSearch.trigger",
"when": "editorTextFocus"
},{
"key": "cmd+d",