Skip to content

Instantly share code, notes, and snippets.

Avatar

shinriyo shinriyo

View GitHub Profile
@shinriyo
shinriyo / user.onUpdate.ts
Created Jul 24, 2020
Sync Document for update (AddSearch with Firestore, Functions, TypeScript)
View user.onUpdate.ts
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 Jul 24, 2020
Sync Document for delete (AddSearch with Firestore, Functions, TypeScript)
View user.onDelete.ts
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 Jul 24, 2020
Sync Document for create (AddSearch with Firestore, Functions, TypeScript)
View user.onCreate.ts
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" }
View main.dart
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 Sep 28, 2018
SVGで色を無理やり付ける(IE, Edge) TypeScript
View paintSVG.ts
/**
* 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 Jul 31, 2018
東京医科歯科大学と東京医科大学と東京歯科大学全てにマッチするbash正規表現
View univ.sh
#!/bin/bash
univ="東京医科歯科大学"
if [[ ${univ} =~ ^東京(医科)?(歯科)?大学$ ]]; then
all=${BASH_REMATCH[0]}
echo part1. ${all}
fi
univ="東京医科大学"
@shinriyo
shinriyo / hoge.html
Last active Jul 27, 2018
いろんなフォント
View hoge.html
<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 Sep 4, 2016
これをコピペで使う
View app.js
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 Aug 11, 2016
Xamarinローカライズのメモメソッド
View LocalizeSetting.cs
/// <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 Jun 25, 2016
MonoDevelopに慣れた人のVisual Studio Codeのkeybinding.jsonを晒すぜ
View 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",
You can’t perform that action at this time.