- Create a Dart scratch file (Cmd+Shift+N)
- Paste in the body of any snippet into the scratch file
- Remove the double quotes and extra commas (Cmd+R is the replace command)
- Replace the token placeholders with variable names (${1} =>
$placeholderName$ ) - Highlight the transformed code, and go to Tools > Save as Live Template
- Add the abbreviation and description as seen in the dialog box below
- Make sure to add a default value to each variable used (see the edit variables button on live template dialog below)
- Once saved you can use the stkv template anywhere in the Flutter/Dart scope
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 admin from 'firebase-admin'; | |
const db = admin.firestore() | |
export async function onUserCreated(user: any): Promise<boolean> { | |
if(typeof user.phoneNumber != "undefined") { | |
const batch = db.batch() | |
batch.set(db.collection("users").doc(user.uid), { | |
"phoneNumber": user.phoneNumber, | |
"creationTime": new Date(user.metadata.creationTime), |
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
$ brew install markdown htmldoc | |
$ markdown <file.md> | htmldoc --cont --headfootsize 8.0 --linkcolor blue --linkstyle plain --format pdf14 - > <file.pdf> |
- Everything needs to be run in Terminal
- Check your man search path using manpath
- Type manpath to see available locations
- Use share for pages accessible to all users
- Some versions of man epect to see gzipped files
- Check the folders of existing man pages to view file formats expected
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
// Copyright 2019 The Flutter team. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
import 'package:gallery/l10n/gallery_localizations.dart'; | |
enum GridListDemoType { | |
imageOnly, | |
header, |
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
Note: This example contains Chinese text and a payload of nested JSON. The payload had to be encoded as a string before being passed on to the API. I found that using the flutter http package one has to use a workaround to decode the characters properly (dart-lang/http#243). The alternative is to use the dio package which encodes everything as utf-8 properly. When decoding the get request, one has to remember to also decode the nested json separately. | |
Fix for others having this issue: | |
Flutter has a new network profiler in the Dart tools. Using this I was able to see that an error returned that Field payload does not have a default value. | |
Solution: | |
Add a default NULL value to the payload field and with that inserts are now working. | |
My payload is a json field so I had to jsonEncode(payload) before adding it to the post (in my toJson method) | |
Also found that I could simply wrap the entire jsonEncode(post) with single quotes |
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
// source/exampple @ https://jsfiddle.net/mingsai/jqt0732k/2/ | |
<!DOCTYPE html> | |
<html> | |
<title>W3.CSS</title> | |
<style> | |
#thumbwrap { | |
position:relative; | |
margin:75px auto; |
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
--- References | |
https://jsfiddle.net/mingsai/ybt5pdg4/39/ | |
(original article) https://designshack.net/articles/css/use-pseudo-elements-to-create-an-image-stack-illusion/ | |
--- HTML | |
<a class='featured-img-box'> | |
<img src="https://st2.depositphotos.com/1653909/8228/i/950/depositphotos_82284502-stock-photo-magician-hands-with-magic-wand.jpg" height=100% width=100% /> | |
</a> | |
--CSS |
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
/* | |
Super Constructor in Dart | |
In dart, the subclass can inherit all the variables and methods of the parent class, with the use of extends keyword but it can’t inherit constructor of the parent class. To do so we make use of super constructor in the dart. There are two ways to call super constructor: | |
Implicitly | |
Explicitly | |
When calling explicitly we make use of super constructor as: | |
*/ |