View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CircleStack extends StatefulWidget { | |
@override | |
_CircleStackState createState() => _CircleStackState(); | |
} | |
class _CircleStackState extends State<CircleStack> { | |
bool open = true; | |
@override | |
Widget build(BuildContext context) { |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dog { | |
String breed; | |
int age; | |
Dog({ this.age, this.breed }); | |
factory Dog.fromMap(data) { | |
return Dog( | |
breed: data['breed'], | |
age: data['age'], |
View config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as firebase from 'firebase/app'; | |
import 'firebase/firestore'; | |
var firebaseConfig = { | |
// your firebase credentials | |
}; | |
// Initialize Firebase | |
firebase.initializeApp(firebaseConfig); |
View print.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const print = (v) => { | |
const el = document.createElement('h3'); | |
el.innerText = '🔵 ' + v; | |
document.body.appendChild(el); | |
} |
View angular-hooks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { BehaviorSubject } from 'rxjs'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<p>You clicked {{count.value}} times</p> | |
<button (click)="setCount(count.value + 1)">Click Me</button> | |
`, | |
}) |
View state-alt.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
Stream<bool> interval = | |
Stream.periodic(Duration(seconds: 1), (i) => (i % 2 == 0)) | |
.asBroadcastStream(); | |
class Blink extends StatelessWidget { | |
String text; | |
Blink({Key key, this.text}) : super(key: key); |
View emoji.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const emojis = | |
'😀,😃,😄,😁,😆,😅,😂,🤣,😊,🙂,🙃,😉,😌,😍,😘,😗,😙,😚,😋,😛,😝,😜,🤪,🤨,🧐,🤓,😎,🤩,😏,😒,😞,😔,😟,😕,🙁,😣,😖,😫,😩,😢,😭,😤,😠,😡,🤬,🤯,😳,😱,😨,😰,😥,😓,🤗,🤔,🤭,🤫,🤥,😶,😐,😑,😬,🙄,😯,😦,😧,😮,😲,😴,🤤,😪,😵,🤐,🤢,🤮,🤧,😷,🤒,🤕,🤑,🤠,😈,👿,👹,👺,🤡,💩,👻,💀,👽,👾,🤖,🎃,😺,😸,😹,😻,😼,😽,🙀,😿,😾,🤲,👐,🙌,👏,🤝,👍,👎,👊,✊,🤛,🤞,🤟,🤘,👌,👉,👈,👆,👇,✋,🤚,🖐,🖖,👋,🤙,💪,🖕,🙏'; | |
export const emojisArray = emojis.split(','); | |
export const emojiRandom = () => | |
emojisArray[Math.floor(Math.random() * emojisArray.length)]; |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.0/lodash.min.js"></script> | |
<style> | |
body { | |
text-align: center; | |
display: flex; |
View fcm.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BUG: never emits token on first permission granted | |
this.fcm.getToken.subscribe(console.log); | |
// Works Fine | |
this.fcm.requestPermission | |
.pipe( | |
switchMap(v => { | |
return this.fcm.requestToken; | |
}) | |
) |
View ref.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class DocRef { | |
private ref: firebase.firestore.DocumentReference; | |
private stream; | |
constructor(private path: string) { | |
this.ref = firebase.firestore().doc(path); | |
this.stream = Observable.create(observer => { | |
this.ref.onSnapshot({ | |
next(doc) { | |
observer.next(doc); |
NewerOlder