Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
<?xml version="1.0" encoding="UTF-8" ?> | |
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<types> | |
<members>*</members> | |
<name>ApexClass</name> | |
</types> | |
<types> | |
<members>*</members> | |
<name>ApexComponent</name> | |
</types> |
Trong hình là đoạn sông Mekong khổng lồ bị cạn trơ đáy chỉ còn một dòng nước nhỏ ở chính giữa ở gần làng Sangkhom (thuộc tỉnh Nong Khai, Thái Lan) vào tháng 1/2020. Đây là đoạn sông Mekong vừa thoát ra khỏi Lào, cũng như bắt nguồn từ con sông Lan Thương (Lancang), chảy từ các khối băng thuộc dãy Himalayas, cao nguyên Tây Tạng (tỉnh Thanh Hải) và Thanh Tạng (tỉnh Vân Nam, Trung Quốc).
Ảnh này là của New York Times, được đăng trong bài viết nói về dữ kiện vệ tinh của Mỹ cho thấy dù nước về trên cao nguyên Tây Tạng và đang làm mùa mưa/tuyết tan, nhưng có một khối lượng nước khổng lồ được giữ lại trong lãnh thổ Trung Quốc khiến phần sông Mekong từ Lào đến Thái Lan hoàn toàn khô cạn. Xem:
https://www.nytimes.com/2020/04/13/world/asia/china-mekong-drought.html
export const h=(t,p,...c)=>({t,p,c,k:p&&p.key}) | |
export const render=(e,d,t=d.t||(d.t={}),p,r,c,m,y)=> | |
// arrays | |
e.map?e.map((e,p)=>render(e,d,t.o&&t.o[p])): | |
// components | |
e.t.call?(e.i=render((render.c=e).t(Object.assign({children:e.c},e.p),e.s=t.s||{},t=> | |
render(Object.assign(e.s,t)&&e,d,e)),t.i||d,t&&t.i||{}),d.t=t=e):( | |
// create notes | |
m=t.d||(e.t?document.createElement(e.t):new Text(e.p)), | |
// diff props |
#! /usr/bin/env stack | |
-- stack --resolver lts-18.8 script | |
{-# LANGUAGE OverloadedStrings #-} | |
{- | |
This is a handy illustration of converting between five of the commonly-used | |
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy | |
Text). |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /your/root/path; | |
index index.html; | |
server_name you.server.com; |
In the past, I've written composition functions in both Elm and Haskell that take multiple parameters for the leftmost function, i.e. the function that gets applied first.
(All examples here are in Haskell)
Here was my Haskell implemenation (stolen from the web):
compose2 :: (c -> d) -> (a -> b -> c) -> a -> b -> d
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
import React, { Component } from 'react'; | |
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux'; | |
import { provide, connect } from 'react-redux'; | |
import thunk from 'redux-thunk'; | |
const AVAILABLE_SUBREDDITS = ['apple', 'pics']; | |
// ------------ | |
// reducers | |
// ------------ |
Generally, Generator
is a object returned by a generator function that behaves like an Iterator
. In Javascript, according to Mozilla:
The Generator object is returned by a generator function and it conforms to both the iterator and the Iterable protocol.
While a normal function will return a value using return
keyword, Generator
uses yield
keyword to generate a rule to create values rather than the actual values. In other words, it is the lazily way to generate values.
The obvious benefit of Generator
is improving the performance and help us to organize source code better. This is a new feature in ES6, but it has been implemented in other languages (e.g.Python, C# etc) for a long time.