Skip to content

Instantly share code, notes, and snippets.

@davidkpiano
davidkpiano / css-state-machines.md
Last active June 15, 2023 15:26
Article for creating CSS State Machines

As the number of different possible states and transitions between states in a user interface grows, managing styles and animations can quickly become complicated. Even a simple login form has many different "user flows":

https://codepen.io/davidkpiano/pen/WKvPBP

State machines are an excellent pattern for managing state transitions in user interfaces in an intuitive, declarative way. We've been using them a lot on the Keyframers as a way to simplify otherwise complex animations and user flows, like the one above.

So, what is a state machine? Sounds technical, right? It’s actually more simple and intuitive than you might think. (Don’t look at Wikipedia just yet… trust me.)

Let’s approach this from an animation perspective. Suppose you’re creating a loading animation, which can be in only one of four states at any given time:

@wizardforcel
wizardforcel / psyco.md
Last active April 13, 2022 09:57
编程随想::心理学书籍 IPFS 备份

https://ipfs.io/ipfs/{hash}

user@ubuntu:~/Downloads/心理学$ ipfs add -r .
added QmerE4f5kabqmMunMwGu5UsUS347bcr7wDEhF1wHANh3ck 心理学/(其它)/丹·艾瑞里:怪诞行为学 (扫描版).pdf
added QmRbvAnZ6qAhDozFjc9wxmMhK1Gv4QecUXhtbd5K3Dxw1r 心理学/(其它)/丹·艾瑞里:怪诞行为学.epub
added Qmeq2MfRYrRDrXiwfFtjcz1kGC2gVPY7sqoxQLonJuTCcS 心理学/(其它)/丹·艾瑞里:怪诞行为学2.epub
added QmfQc7G8pLbBtzkNk5gNhCrkaYVd2tGioNrZJTXFxviwQP 心理学/(其它)/基思·斯坦诺维奇:与众不同的心理学——如何正视心理学 (第7版 扫描版).pdf
added QmVoSP6JmrGTP3KWE9onL6ygqhenHFjbeyFTzDVe1GumfP 心理学/(其它)/基思·斯坦诺维奇:对伪心理学说不 (第8版 扫描版).pdf
added QmP6pcyNv4eFdfitk6H8krde6RBAFyteCHfHZYhsDpAWjK 心理学/(其它)/基思·斯坦诺维奇:对伪心理学说不 (第8版).epub
@weihanglo
weihanglo / rust-vs-go.md
Last active February 16, 2025 04:02
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!


@gvolpe
gvolpe / di-in-fp.md
Last active September 16, 2024 07:18
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 11, 2025 07:07
Swift Concurrency Manifesto
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 14, 2025 19:31
Hyperlinks in Terminal Emulators
@dmpetrov
dmpetrov / save_dataframe_in_single_csv.scala
Created March 6, 2017 05:07
Save Spark dataframe to a single CSV file
# Code for blogpost:
# https://fullstackml.com/2015/12/21/how-to-export-data-frame-from-apache-spark/
def saveDfToCsv(df: DataFrame, tsvOutput: String,
sep: String = ",", header: Boolean = false): Unit = {
val tmpParquetDir = "Posts.tmp.parquet"
df.repartition(1).write.
format("com.databricks.spark.csv").
option("header", header.toString).
@patpohler
patpohler / Big List of Real Estate APIs.md
Last active May 7, 2025 20:21
Evolving list of Real Estate APIs by Category

Big List of Real Estate APIs

Listings / Property Data

####Rets Rabbit http://www.retsrabbit.com

Rets Rabbit removes the nightmare of importing thousands of real estate listings and photos from RETS or ListHub and gives you an easy to use import and Web API server so you can focus on building your listing search powered website or app.