Skip to content

Instantly share code, notes, and snippets.

View nomyfan's full-sized avatar
🍵
得閑飲茶

Kim Chan nomyfan

🍵
得閑飲茶
View GitHub Profile
@nomyfan
nomyfan / App.css
Created August 28, 2022 05:18
Color tinting - background-image solution
.box {
width: 300px;
height: 250px;
background-color: cornflowerblue;
transition: 0.5s background-color;
background-size: cover;
background-position: center;
background-blend-mode: luminosity;
@nomyfan
nomyfan / App.css
Created August 28, 2022 03:08
filter: drop-shadow
.box {
width: 300px;
height: 250px;
color: deeppink;
border: 2px solid;
text-shadow: 0.1em 0.2em yellow;
filter: drop-shadow(0.05em 0.05em 0.1em gray);
/*box-shadow: 0.05em 0.05em 0.1em gray;*/
}
@nomyfan
nomyfan / App.css
Created July 28, 2022 05:11
CSS pie chart - SVG solution
body {
margin: 0;
}
svg {
height: 100px;
width: 100px;
background-color: yellowgreen;
border-radius: 50%;
transform: rotateZ(-90deg);
@nomyfan
nomyfan / App.css
Last active July 27, 2022 16:28
CSS pie chart - transform-based solution
body {
margin: 0;
}
.pie {
background-color: yellowgreen;
height: 100px;
width: 100px;
border-radius: 50%;
@nomyfan
nomyfan / App.css
Created July 27, 2022 14:42
CSS trapezoid
nav > a {
position: relative;
display: inline-block;
padding: .3em 1em 0;
cursor: pointer;
}
nav > a + a {
margin-left: -10px;
}
@nomyfan
nomyfan / chessboard.css
Last active July 27, 2022 14:53
CSS chessboard
.box {
height: 300px;
width: 300px;
background: #eee;
background-size: 30px 30px;
/* 最后的0 0可以省略不写 */
background-position: 0 0, -15px 15px, 15px 15px, 0 0;
/* 利用background-position给三角形增加偏移,拼接成两个正方形 */
@nomyfan
nomyfan / dnscrypt-proxy.toml
Created March 6, 2022 06:13
DNS crypt proxy config
cloaking_rules = 'cloaking-rules.txt'
listen_addresses = ['0.0.0.0:53']
max_clients = 250
ipv4_servers = true
ipv6_servers = false
timeout = 5000
keepalive = 30
cert_refresh_delay = 240
ignore_system_dns = true
cache = true
@nomyfan
nomyfan / reverseHosts.js
Created March 6, 2022 06:10
Reverse hosts
const fs = require('fs');
/**
* @param {string}line
* @return {[string, string] | null}
*/
function matchHost(line) {
const segments = line.split(' ').filter((seg) => !!seg);
if(segments.length !== 2) {
return null;
@nomyfan
nomyfan / QuickSort.hs
Last active February 5, 2022 14:47
Quick sort in Haskell
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort (filter (<=x) xs)
biggerSorted = quicksort (filter (>x) xs)
in smallerSorted ++ [x] ++ biggerSorted
@nomyfan
nomyfan / PROFILE.ps1
Last active April 23, 2022 07:32
PowerShell Setup
Import-Module -Name Terminal-Icons
Import-Module -Name z
# Set-Alias z Search-NavigationHistory
Import-Module posh-git
oh-my-posh init pwsh -c "C:\Users\username\AppData\Local\Programs\oh-my-posh\themes\star.omp.json" | Invoke-Expression