Executable and Linkable Format (ELF), is the default binary format on Linux-based systems.
| // you need this in your cargo.toml | |
| // reqwest = { version = "0.11.3", features = ["stream"] } | |
| // futures-util = "0.3.14" | |
| // indicatif = "0.15.0" | |
| use std::cmp::min; | |
| use std::fs::File; | |
| use std::io::Write; | |
| use reqwest::Client; | |
| use indicatif::{ProgressBar, ProgressStyle}; |
As a developer I have noticed a trend in libraries where the library developer will write this amazing
library that does everything you need it to except that it has a .run() or .start() method. The
intent is for the user of said library to do the initialization code in the application entry point
and then do something like return app.run();. Whether it's in Python, Java, C++, or Rust they all
abstratct away the application's main event loop.
What is an event loop?
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Canvas</title> |
| #include <iostream> | |
| #include <string> | |
| #include <queue> | |
| #include <unordered_map> | |
| using namespace std; | |
| // A Tree node | |
| struct Node | |
| { | |
| char ch; |
| $path = $args[0] | |
| Add-Type -AssemblyName PresentationFramework | |
| [System.Windows.MessageBox]::Show("Hello $path") |
| /// Multi-level sort a slice of Foobars according to [(field, reverse)] | |
| fn sort_by_names(f: &mut [Foobar], orderings: &[(Foofields, bool)]) { | |
| use std::cmp::Ordering; | |
| f.sort_by(|a, b| { | |
| let mut cmp = Ordering::Equal; | |
| for (field, reverse) in orderings { | |
| if cmp != Ordering::Equal { | |
| break; | |
| } |
React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.
Table of Contents
React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.
| import React from "react" | |
| class Form extends React.Component { | |
| state = { | |
| cats: [{name:"", age:""}], | |
| owner: "", | |
| description: "" | |
| } | |
| handleChange = (e) => { | |
| if (["name", "age"].includes(e.target.className) ) { | |
| let cats = [...this.state.cats] |
