Skip to content

Instantly share code, notes, and snippets.

View Alicebond's full-sized avatar
🦄
Self-teaching

Bin Zhang Alicebond

🦄
Self-teaching
View GitHub Profile
@Alicebond
Alicebond / DOM3D.js
Created March 28, 2024 22:57 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@Alicebond
Alicebond / Web Component for Copyright Years.md
Created March 28, 2024 22:57
Web Component for Copyright Years

无用知识的有用性

弗莱克斯纳

[按] 30年代美国普林斯顿大学校长亚伯拉罕·弗莱克斯纳(Abraham Flexner)教授曾以 “无用知识的有用性”为题,发表过一篇在科学界有影响的文章。该文章强调了基础研 究以及自由探索的重要性。全文一万余字,现节译如下,以餐读者。

  智力与精神生活在表面上是一种无用型活动。人们之所以大量从事这种活动,是因

@Alicebond
Alicebond / gist:a6ce4e07f0473acc678416b1ac1ba1a1
Created February 4, 2022 18:15 — forked from EvanHahn/gist:2587465
Caesar shift in JavaScript
/*
JavaScript Caesar shift
by Evan Hahn (evanhahn.com)
"Encrypt" like this:
caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!"
And "decrypt" like this:
@Alicebond
Alicebond / README.md
Created September 10, 2021 18:28 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@Alicebond
Alicebond / gh-pages-deploy.md
Created August 30, 2021 20:01 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@Alicebond
Alicebond / ds_store_removal
Last active August 23, 2021 21:24 — forked from vybstat/ds_store_removal
How to remove .DS_Store file from GitHub that Mac OS X creates
# remove .DS_Store file from GitHub that MAC OS X creates
# find and remove .DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
# create .gitignore file, if needed
touch .gitignore
echo .DS_Store > .gitignore
# push changes to GitHub