Skip to content

Instantly share code, notes, and snippets.

View rdlabo's full-sized avatar

Masahiko Sakakibara rdlabo

View GitHub Profile
@rdlabo
rdlabo / ionic.ts
Created August 26, 2019 02:33
Ionic Storage & HTTP
@Injectable({
providedIn: 'root',
})
export class AuthService {
constructor(
public http: HttpClient,
public storage: Storage,
) {}
async getState() {
@rdlabo
rdlabo / gist:e0712194682636d0de648a0fc88a5465
Created August 23, 2019 14:45
Ionic/AngularのAngular 8へのアップデートコマンド
$ yarn add @ionic/angular@4.7.1 @ionic/angular-toolkit@2.0.0 -D
$ yarn add @angular-devkit/architect@0.801.2 @angular-devkit/build-angular@0.801.2 @angular-devkit/core@8.1.3 @angular-devkit/schematics@8.1.3 @angular/cli@8.1.3 @angular/compiler@8.1.3 @angular/compiler-cli@8.1.3
(場合によってはここでnode_moduleを削除しないといけないかも)
$ npx ng update @angular/core@8.1.3 @angular/cli@8.1.3
@rdlabo
rdlabo / keyboard-attach.directive.ts
Last active September 25, 2019 10:02 — forked from Manduro/keyboard-attach.directive.ts
Ionic Keyboard Attach Directive
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { Keyboard } from '@ionic-native/keyboard';
import { Content, Platform } from 'ionic-angular';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
/**
* @name KeyboardAttachDirective
* @source https://gist.github.com/rdlabo/942671d8c9cffb02676756cdd56aa1c0
* @forked https://gist.github.com/Manduro/bc121fd39f21558df2a952b39e907754
@rdlabo
rdlabo / gist:82ecf251653c8f8bbc80e4a5f1c75bf3
Last active December 5, 2017 14:45
dispatcher$.nextをPromiseっぽく使いたい

// Components側の処理で、dispatcher$.nextを実行するnextState$()メソッド完了時に、refresherの終了処理行いたい

export class Timeline {
    doRefresh(refresher) {
       this.stream.nextState$().then(
          data => refresher.complete();  // refresherの完了
        }
        }
       );
@rdlabo
rdlabo / gist:6a939c9b20e12008fa481e28d930bbb2
Created July 7, 2017 06:26
過去365日の日付をカルムで表示(サブクエリ等にお使い下さい)
SELECT
DATE_FORMAT(DATE_ADD(NOW(), INTERVAL @i := @i - 1 DAY),'%Y-%m-%d') create_date
FROM `information_schema`.COLUMNS,(SELECT @i:=0) s
LIMIT 365