Skip to content

Instantly share code, notes, and snippets.

View yanhaijing's full-sized avatar
🏠
Working for jsmini.cc

颜海镜 yanhaijing

🏠
Working for jsmini.cc
View GitHub Profile
function addEvent(element, event, callback) {
if (element.addEventListener) {
element.addEventListener(event, callback, false)
} else if (element.attachEvent) {
element.attachEvent('on' + event, callback);
} else {
element['on' + event] = callback;
}
}
{"lastUpload":"2020-05-27T03:59:33.528Z","extensionVersion":"v3.4.3"}
@yanhaijing
yanhaijing / auto-follow-github.js
Created November 8, 2013 10:41
自动follow github帐号
(function ($) {
var
followers = ["zedshaw"];
followeds = [];
function follow(id, callback) {
$.post('https://github.com/users/follow', {target: id}, function(data, textStatus, xhr) {
/*optional stuff to do after success */
callback(id, data);
//console.log("成功follow ", id, "此人共有", data.count, "位粉丝");
@yanhaijing
yanhaijing / Gruntfile.js
Created December 26, 2015 07:17 — forked from markgoodyear/01-gulpfile.js
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* Grunt
* $ npm install grunt-contrib-uglify grunt-autoprefixer grunt-contrib-cssmin grunt-contrib-imagemin grunt-contrib-sass grunt-contrib-watch grunt-contrib-concat grunt-contrib-clean grunt-contrib-jshint grunt-notify --save-dev
*/
module.exports = function(grunt) {
grunt.initConfig({
// Sass
@yanhaijing
yanhaijing / refresh-website.js
Last active December 22, 2015 21:28
刷新任意网站,无限制
var total = 0
function loop(){
console.log("=====total count", total++);
$.ajax({
url: "http://mixin.tongda2000.com/?" + Math.random(),
error: function(){
loop();
},
success: function(){
loop();
@yanhaijing
yanhaijing / Httplib.php
Created May 1, 2013 14:25
php访问http文件
/**
* http下载类库
*/
class Httplib{
// 目标网站无法打开时返回的错误代码
var $_ERROR_CONNECT_FAILURE = 600;
// 自定义 UserAgent 字符串
var $_SEND_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; LazyCMS.net::DownLoader)';
var $_url,$_method,$_timeout;
var $_scheme,$_host,$_port,$_path,$_query,$_referer;
@yanhaijing
yanhaijing / 约瑟夫环.c
Created April 13, 2013 00:59
上机约瑟夫环链表实验
/*上机约瑟夫环链表实验*/
/*版权 颜海镜 所有*/
#include<stdio.h>
#include <malloc.h>
#include "stdlib.h"
typedef struct Node
{
int data;
struct Node *next;
@yanhaijing
yanhaijing / xlat317.asm
Created April 12, 2013 14:50
数制转
;颜海镜 2011.9.30
;3.17数制转换
.model small
.statck
.data
LEDtable db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h,88h,83h,0c6h,0c1h,86h,8eh
LEDnum db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0ah,0bh,0ch,0dh,0eh,0fh
.code
start: mov ax,@data
mov ds,ax;初始化数据段基址
@yanhaijing
yanhaijing / upper.asm
Created April 12, 2013 14:49
小写字母转换成大写字幕
;颜海镜 2011.9.29 小写字母转换成大写字幕
;最终解释权归颜海镜所有
.model small
.stack
.data
msgkey db 'Press any key to continue ...','$'
msgin db 'input:','$'
msgout db 'output:','$'
enterr db 0dh,0ah,'$'
.code
@yanhaijing
yanhaijing / firstasm.asm
Created April 12, 2013 14:47
第一个汇编程序
;lt301a.asm
.model small
.stack
.data
string db 'Hello, Everybody !',0dh,0ah,'$'
.code
start: mov ax,@data
mov ds,ax
mov dx,offset string
mov ah,9