Skip to content

Instantly share code, notes, and snippets.

View zxc0328's full-sized avatar
💻
古法编程ing

Harold Zhao zxc0328

💻
古法编程ing
View GitHub Profile
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
let count = 1;
const fakeFetch = () => {
return new Promise(resolve => {
setTimeout(() => {
count += 1;
var request = require('request')
request({
// will be ignored
method: 'POST',
uri: 'http://portal.ccnu.edu.cn/loginAction.do',
followRedirect: false,
headers: {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
},
form: {
@zxc0328
zxc0328 / Levenshtein.js
Last active January 25, 2017 05:06
Levenshtein distance implemented in JavaScript
/**
** Levenshtein distance implemented in JavaScript
** by zindex
**/
const Manipulation = {
INSERTION: Symbol('INSERTION'),
DELETION: Symbol('DELETION'),
MATCH: Symbol('MATCH'),
SUBSTITUTION: Symbol('SUBSTITUTION')
@zxc0328
zxc0328 / gist:02b13ac22b96cf15ad48e8968666614c
Last active January 22, 2017 15:59
Longest common sequence implemented in JavaScript
/**
** Longest common sequence implemented in JavaScript
** by zindex
**/
const Manipulation = {
INSERTION: Symbol('INSERTION'),
DELETION: Symbol('DELETION'),
MATCH: Symbol('MATCH')
}
// utility
function getElementsByClassNameIter(name) {
let results = []
function testClassName(node) {
if ((new RegExp(name).test(node.className)))
{
results.push(node)
}
<html>
<head>
<title>image loader</title>
</head>
<style>
body{
padding: 0;
margin: 0;
}
img{