Skip to content

Instantly share code, notes, and snippets.

View henyihanwobushi's full-sized avatar

Donsen Hong henyihanwobushi

  • China University of Geoscience in Beijing
View GitHub Profile
@henyihanwobushi
henyihanwobushi / BaseQueryValidator.java
Created March 19, 2023 13:37 — forked from piyusht007/BaseQueryValidator.java
SQL parsing in java using Apache-Calcite SQL parser.
public class BaseQueryValidator {
private static List<String> extractTableAliases(SqlNode node) {
final List<String> tables = new ArrayList<>();
// If order by comes in the query.
if (node.getKind().equals(SqlKind.ORDER_BY)) {
// Retrieve exact select.
node = ((SqlSelect) ((SqlOrderBy) node).query).getFrom();
} else {
node = ((SqlSelect) node).getFrom();
@henyihanwobushi
henyihanwobushi / settings.xml
Created September 30, 2021 17:48 — forked from python012/settings.xml
Maven settings.xml with aliyun mirror
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@henyihanwobushi
henyihanwobushi / simple_args_parsing.sh
Last active May 18, 2023 06:56 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
# a simple way to parse shell script arguments
# please edit and use to your own content
ENVIRONMENT="dev"
DB_PATH="/data/db"
function usage()
{
echo "if this was a real script you would see something useful here"
@henyihanwobushi
henyihanwobushi / setup_haskell.sh
Created January 16, 2018 19:38 — forked from gwax/setup_haskell.sh
Haskell on OSX
brew cask install haskell-platform
echo 'export PATH="$PATH/Library/Haskell/bin:$PATH"' >> ~/.bash_profile
cabal update
cabal install -j8 happy
cabal install -j8 stylish-haskell
cabal install -j8 hlint
cabal install -j8 hsdev hasktags
cabal install -j8 ghc-mod
# Sublime: install SublimeHaskell package
# VS Code: install "Haskell ghc-mod", "Haskell Syntax Highlighting", "haskell-linter", "stylish-haskell" extensions
"""Distance helpers."""
import math
EARTH_CIRCUMFERENCE = 6378137 # earth circumference in meters
def great_circle_distance(latlong_a, latlong_b):
"""

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.