Skip to content

Instantly share code, notes, and snippets.

View skyhacker2's full-sized avatar
💭
haha

Eleven Chen skyhacker2

💭
haha
View GitHub Profile
class Test
{
public:
Test();
};
jQuery(document).ready(function($) {
// $(".gifImg").attr('src', './images/loading.gif');
/**
* Created by Jolam on 2014/11/30.
*/
var ResourceLoader = (function (Config, Util, _, Backbone) {
var ResourceLoader = function (opts) {
this.files = opts.files;
@skyhacker2
skyhacker2 / gist:2723fd12f5753aa6c7586dd6b5409db3
Created May 24, 2016 07:05 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
@skyhacker2
skyhacker2 / HttpDigestAuth.java
Created December 1, 2016 08:52 — forked from slightfoot/HttpDigestAuth.java
HTTP Digest Auth for Android (incomplete and probably hackable, but works!)
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
@skyhacker2
skyhacker2 / 按需加载图片Demo.html
Created August 27, 2017 15:35
按需加载图片,就是让图片默认开始不加载,而且在接近可视区域范围时,再进行加载。也称之为懒惰加载。 1.生成标签时,用data-src来保存图片地址; 2.记录的图片data-src都保存到数组里; 3.对滚动条进行事件绑定,假设绑定的函数为function lazyload(){}; 4.在函数lazyload中,按照下面思路实现:计算图片的Y坐标,并计算可视区域的高度height,当Y小于等于(height+ scrollTop)时,图片的src的值用data-src的来替换,从而来实现图片的按需加载;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>图片按虚加载</title>
</head>
<body>
<style type="text/css">
li { float: left; width: 200px; clear:both;}
</style>