Inheritance and Virtual Table are often used to create interface in C++ polymorphic class
What if ... there were another way to do this ?
easier, cleaner, faster and more reliable
This article explains how to useCRTP, [std::variant](https://en.cppreference.com/w/cpp/utility/variant andstd::visitto increase code performance.
In this article, we will see how to use
CRTP,std::variantandstd::visitto increase our code performances.
This file contains hidden or 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/widgets.dart"; | |
| import "dart:math"; | |
| class SnappingListView extends StatefulWidget { | |
| final Axis scrollDirection; | |
| final ScrollController controller; | |
| final IndexedWidgetBuilder itemBuilder; | |
| final List<Widget> children; | |
| final int itemCount; |
This file contains hidden or 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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import 'paged_listview.dart'; | |
| void main() => runApp(MaterialApp(home: HomeScreen())); | |
| class HomeScreen extends StatefulWidget { | |
| @override | |
| _HomeAppState createState() => _HomeAppState(); | |
| } |
This file contains hidden or 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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(new MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return new MaterialApp( |
This table was created in 2015 so may be quite outdated today.
| Feature | Meteor Solution | Alternative Solutions | Description |
|---|---|---|---|
| Live DB Sync | [livequery][lq] ([mongo-oplog]), [ddp] | RethinkDB, Redis, ShareDB, [npm:mongo-oplog], [firebase], etc. | Push DB updates to client/server. |
| Latency Compensation, Optimistic UI | [minimongo][mm] | [RethinkDB][lcr], [mWater/minimongo] (fork, not ws but http, browserify) | Imitate successful db query on client before it is done. |
| Isomorphic Code | [isobuild] & isopacks | browserify | Write one code for server/client/mobile. |
| Isomorphic Packaging | [isobuild], atmosphere | No more separate packages for server & client. Get bower + npm + mobile. |
This file contains hidden or 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
| #ifndef _UNISTD_H | |
| #define _UNISTD_H 1 | |
| /* This file intended to serve as a drop-in replacement for | |
| * unistd.h on Windows. | |
| * Please add functionality as neeeded. | |
| * Original file from: http://stackoverflow.com/a/826027 | |
| */ | |
| #include <stdlib.h> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains hidden or 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
| package main | |
| import ( | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "fmt" | |
| ) | |
| func EncryptAESCFB(dst, src, key, iv []byte) error { | |
| aesBlockEncrypter, err := aes.NewCipher([]byte(key)) |