Skip to content

Instantly share code, notes, and snippets.

View mshk's full-sized avatar

Masahiko Tachizono mshk

View GitHub Profile
@mshk
mshk / BacklogExporter.ts
Created February 23, 2022 08:52
Backlog Wiki exporter
import * as backlogjs from 'backlog-js';
import 'dotenv/config';
import 'cross-fetch/polyfill';
import * as fs from 'fs';
type Wiki = {
name: string;
content: string
}
import { useState, useEffect } from 'react';
export const ReactHooksQuiz01 = () => {
const [isInitialized, setIsInitialized] = useState(false);
console.log('a) isInitialized = ', isInitialized);
useEffect(() => {
setIsInitialized(true);
handleEmailLogin(event) {
firebaseAuth()
.signInWithEmailAndPassword(this.state.emailField, this.state.passwordField)
.catch(function (error) {
if (error) {
console.error('Error(' + error.code + '): ' + error.message);
}
});
}
import { firebaseAuth, firebaseDb } from '../../lib/firebase'
constructor(props) {
super(props)
this.provider = new firebaseAuth.TwitterAuthProvider()
}
handleTwitterLogin(event) {
firebaseAuth().signInWithPopup(this.provider)
@mshk
mshk / firebase-email-signup.js
Created October 26, 2017 05:57
Firebase Auth Sample
handleEmailSineup(event) {
firebaseAuth()
.createUserWithEmailAndPassword(this.state.emailField, this.state.passwordField)
.catch(function (error) {
if (error) {
console.error('Error(' + error.code + '): ' + error.message);
}
});
}
admin.database().ref("/sites")
.orderByChild('user_count')
.startAt(3)
.limitToLast(20)
.once('value')
.then((snapshot) => {
let sites = snapshots.val()
if (sites == null) { return }
for (let site_key in sites) {
@mshk
mshk / gist:6276780
Last active December 21, 2015 08:18 — forked from matsubo/gist:2543898
Read files under the folder you choose and add them to Evernote as text note. Updated version of https://gist.github.com/matsubo/2543898 . Difference is that this script reads contents of the text files and set them as contents of newly created Evernote notes, instead of adding text files as attachments.
set listOfNames to {}
set theFolder to choose folder "Select the source folder"
tell application "Finder"
set filelist to every file of the folder theFolder
repeat with currentFile in filelist
set currentFileName to (the name of currentFile)
set nom to currentFileName
if text -4 of nom is "." then
set currentFileName to (text 1 thru -5 of nom)
@mshk
mshk / gist:2498914
Created April 26, 2012 11:21
How to get the ip address of network drive mounted via AFP on MacOSX
% netstat -a | grep afp
@mshk
mshk / loadComponentsInTiMVC
Created March 22, 2012 13:32
Load components in TiMVC
// loads Resources/mvc/components/myview.js
self.App.loadComponent('myview');