Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
zhiyelee / abbr.md
Last active August 29, 2022 08:57
Some Common Used Abbreviations

common used phrases

  • AFAIK == as far as I know
  • IMO == in my opinion
  • IMHO == in my humble opinion
  • LGTM == look good to me
  • AKA == also know as
  • ASAP == as sone as possible
  • BTW == by the way
  • FAQ == frequently asked questions
@zhiyelee
zhiyelee / crc_and_md5.md
Last active August 29, 2015 14:04
When is CRC more appropriate to use than MD5/SHA1?

When is it appropriate to use CRC for error detection versus more modern hashing functions such as MD5 or SHA1? Is the former easier to implement on embedded hardware?

http://stackoverflow.com/questions/996843/when-is-crc-more-appropriate-to-use-than-md5-sha1

by @defines http://stackoverflow.com/a/996873/775783
CRC works fine for detecting random errors in data that might occur, for example, from network interference, line noise, distortion, etc.

CRC is computationally much less complex than MD5 or SHA1. Using a hash function like MD5 is probably overkill for random error detection. However, using CRC for any kind of security check would be much less secure than a more complex hashing function such as MD5.

@zhiyelee
zhiyelee / README.md
Last active August 29, 2015 14:00
Introduction to YUI Test

Introduction to the YUI Test

@zhiyelee
zhiyelee / 236-a.js
Last active August 29, 2015 13:59
codeforces
// http://codeforces.com/contest/236/problem/A
function judge(str) {
var arr = str.split('');
var obj = {};
var len = 0;
for (var i = 0; i < arr.length; i++) {
if (!obj[arr[i]]) {
obj[arr[i]] = 1;
len ++;
@zhiyelee
zhiyelee / description.markdown
Last active August 29, 2015 13:57
gView sample -- this description will be showed in the head of the page and used as the title. I just want to make this description long enough.

View gists in a more grace page.

Usage

visit http://g.zhiye.li/:gistid to view the gist, eg

// for below gitst 
https://gist.github.com/zhiyelee/9403314
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="instanceof cross iframe" />
<meta charset="utf-8">
<title>instanceof cross iframe</title>
</head>
<body>
<iframe id="fr" ></iframe>
@zhiyelee
zhiyelee / animal_rabbit.js
Last active August 29, 2015 13:56
__proto__
var animal = { eats: true }
var rabbit = { jumps: true }
rabbit.__proto__ = animal // inherit
console.log(rabbit.eats) // true
var animal = { eats: true }
rabbit = Object.create(animal);
@zhiyelee
zhiyelee / README.md
Last active December 23, 2015 03:08
yui oop demos

yui oop demo gist

  • merge mix

  • OOP

    • extend
    • augment
    • aggregate
  • bind rbind

@zhiyelee
zhiyelee / .gitignore
Last active December 19, 2015 12:19
node js demo
node_modules
/**
* @description check dot whether in a triangle
* @author zhiyelee
*/
/**
* for tri like below:
* A
* * *
* B * * * C