Skip to content

Instantly share code, notes, and snippets.

View yuanchuan's full-sized avatar

Yuan Chuan yuanchuan

View GitHub Profile
@yuanchuan
yuanchuan / index.html
Created December 26, 2019 03:32
Matrix digital rain (animated version)
<main></main>
@yuanchuan
yuanchuan / index.html
Last active October 19, 2018 07:31
Alien land
<css-doodle>
:doodle {
@grid: 20x1 / 60vmin;
overflow: hidden;
}
:container {
transform: scale(25);
filter: @svg-filter(<svg>
<filter>
<feTurbulence baseFrequency="@r(.016, .056, .001)" seed="@r(100)" numOctaves="@r(8, 15)" />
@yuanchuan
yuanchuan / pattern-matching.js
Last active January 12, 2018 15:14
Erlang-like pattern matching in JavaScript
const MARK = {
symbol: {
name: '__mark__',
type: 'condition',
},
add(fn) {
let { name, type } = this.symbol;
let addon = { [name]: type };
return Object.assign((...args) => fn(...args), addon);
},
@yuanchuan
yuanchuan / lambda.js
Last active October 28, 2017 06:28
fun
const assert = require('assert');
const cons = (a, list) => _cons => _cons(a, list);
const car = list => list(head => head);
const cdr = list => list((_, tail) => tail);
const nil = () => null;
const is_nil = list => car(list) === nil();
const length = list =>
is_nil(list) ? 0 : 1 + length(cdr(list));
var notify = (function() {
var origin = document.title.replace(/^\(\d\)?/, '');
var pattern = '(*) ';
return {
clear: function() {
document.title = origin;
},
count: function(n) {
document.title = pattern.replace('*', n) + origin;
}

Keybase proof

I hereby claim:

  • I am yuanchuan on github.
  • I am yuanchuan (https://keybase.io/yuanchuan) on keybase.
  • I have a public key whose fingerprint is 4D7B C6B5 CE47 FC6D 06A7 9350 8355 451C E446 6990

To claim this, I am signing this object:

@yuanchuan
yuanchuan / gist:85554d7f36795558da60
Last active August 29, 2015 14:00
Interstellar Movie - Official Teaser
We’ve always defined ourselves by the ability to overcome the impossible.
And we count these moments.
These moments when we dare to aim higher, to break barriers, to reach for the stars, to make the unknown known.
We count these moments as our proudest achievements.
Are we lost on that?
Perhaps, we’ve just forgotten that we are still pioneers.
And we’ve barely begun.
And that our greatest accomplishments cannot be behind us, because our destiny lies above us.
#/bin/sh
visit() {
awk '!/POST|scripts|images|styles|admin|logshare/ { print $1; }' $1
}
shake() {
awk '/POST/ && /shake/ { print $1; }' $1
}
count() {
wc -l | awk '{print $1}'
@yuanchuan
yuanchuan / gist:5641197
Created May 24, 2013 03:54
note for ie8 quirks
/* Both */
li:last-child, li.last-child {
border: none;
}
/* AND */
li.last-child, li:last-child {
border: none;
/**
* 1. 打开百姓网首页,http://www.baixing.com
* 2. 把下面这段代码复制到控制台并运行(需要chrome :D),
* 3. 然后鼠标移动到 LOGO 上可以看到效果
*/
(function() {
if (!document.createElement('canvas').getContext) return false;