This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*QuickLZ Port to Javascript*/ | |
var QLZ = QLZ || | |
{ | |
REVISION : '1' | |
}; | |
(function(){ | |
// Streaming mode not supported |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compare(x, y) { | |
var z = 0; | |
var s = x.length + y.length;; | |
x.sort(); | |
y.sort(); | |
var a = x.shift(); | |
var b = y.shift(); | |
while(a !== undefined && b !== undefined) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.codec.binary.Hex; | |
import java.security.MessageDigest; | |
import java.util.Random; | |
public class Md5Utils { | |
/** | |
* 加盐MD5加密 | |
* <p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Usage: python archive_articles.py test.csv | |
Input: test.csv | |
name url | |
1 url1 | |
2 url2 | |
..... | |
output: | |
1.png | |
2.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isCalled = false, timer; | |
/** | |
* @param functionTobeCalled 被包装的方法 | |
* @param interval 时间间隔,可省略,默认600毫秒 | |
*/ | |
export default callOnceInInterval = (functionTobeCalled, interval = 600) => { | |
if (!isCalled) { | |
isCalled = true; | |
clearTimeout(timer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import sun.misc.BASE64Decoder; | |
import sun.misc.BASE64Encoder; | |
import javax.imageio.ImageIO; | |
import javax.xml.bind.DatatypeConverter; | |
import java.awt.image.BufferedImage; | |
import java.io.*; | |
import java.util.UUID; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 发布订阅模式中统一由调度中心进行处理,订阅者和发布者互不干扰。这样一方面实现了解耦,还有就是可以实现更细粒度的一些控制。 | |
// 比如发布者发布了很多消息,但是不想所有的订阅者都接收到,就可以在调度中心做一些处理,类似于权限控制之类的。还可以做一些节流操作。 | |
// 在发布订阅模式中,组件是松散耦合的,正好和观察者模式相反。 | |
// 发布-订阅模式大多数时候是异步的(使用消息队列)。 | |
class PubSub { | |
constructor() { | |
this.subscribers = {} | |
} | |
subscribe(type, fn) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 在观察者模式中,观察者是知道Subject的,Subject一直保持对观察者进行记录。 | |
// 观察者模式大多数时候是同步的,比如当事件触发,Subject就会去调用观察者的方法。 | |
// 观察者 | |
class Observer { | |
constructor() { | |
} | |
update(val) { | |
console.log(val); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileFilter; | |
import java.io.IOException; | |
import java.net.JarURLConnection; | |
import java.net.URL; | |
import java.net.URLDecoder; | |
import java.util.ArrayList; | |
import java.util.Enumeration; | |
import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [email protected] | |
* 2017-05-08 | |
*/ | |
'use strict'; | |
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, |
NewerOlder