Skip to content

Instantly share code, notes, and snippets.

View helloyou2012's full-sized avatar

HelloYou helloyou2012

View GitHub Profile
@helloyou2012
helloyou2012 / compilation
Created July 14, 2017 12:17 — forked from wreszelewski/compilation
Compiling dalvikvm for Ubuntu 14.04, creating EC2 image, running hello world
#Some references:
# by Huber Flores:
# https://gist.github.com/huberflores/4687766
# https://gist.github.com/huberflores/9886339
# https://gist.github.com/huberflores/4714824
# by Hai on StackOverflow:
# http://stackoverflow.com/questions/14951374/didnt-find-class-foo-on-path-dexpathlist
# AOSP tutorial: https://source.android.com/source/index.html
@helloyou2012
helloyou2012 / make-fsevents-faster.md
Created March 16, 2016 07:40
Make fsevents install faster from China
vim /etc/hosts
# Add line
127.0.0.1 fsevents-binaries.s3-us-west-2.amazonaws.com
@helloyou2012
helloyou2012 / fn_to_promise.js
Created August 3, 2015 13:48
Wrap a `fn` to a Promise.
/**
* Wrap a `fn` to a Promise.
*
* @param {Function} fn
* @return {fn: Promise, arity: Number}
* @api private
*/
function wrapToPromise(fn) {
var generator = isGenerator(fn) || isGeneratorFunction(fn);
package co.codehunters.speg.core.service.notification;
import java.io.File;
import java.util.HashMap;
import javax.mail.internet.MimeMessage;
import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@helloyou2012
helloyou2012 / cache.js
Last active August 29, 2015 14:15 — forked from bshamric/cache.js
var fs = require('fs');
//this is the path that QTNetwork classes uses for caching files for it's http client
//the path should be the one that has 16 folders labeled 0,1,2,3,...,F
exports.cachePath = '/path/to/phantomjs/cache/data/folder';
//this is the extension used for files in the cache path
exports.cacheExtension = "d";
//the resources that are to be saved
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@helloyou2012
helloyou2012 / gulpfile.js
Last active August 29, 2015 14:15
Gulp 文件配置
var gulp = require('gulp');
var watch = require('gulp-watch');
var shell = require('gulp-shell');
var less = require('gulp-less');
var rimraf = require('gulp-rimraf');
var cssimport = require("gulp-cssimport");
var minifyCSS = require('gulp-minify-css');
var rename = require('gulp-rename');
gulp.task('clean', function() {
antlr\:antlr=2.7.7
aopalliance\:aopalliance=1.0
bsf\:bsf=2.4.0
ch.qos.logback\:logback-classic=1.1.2
com.beust\:jcommander=1.35
com.caucho\:hessian=4.0.7
com.codahale.metrics\:metrics-core=3.0.2
com.codahale.metrics\:metrics-ganglia=3.0.2
com.codahale.metrics\:metrics-graphite=3.0.2
com.codahale.metrics\:metrics-servlets=3.0.2
// Usage: $(element).scrollToTop([position])
;(function($){
// only allow one scroll to top operation to be in progress at a time,
// which is probably what you want
var scrollToTopInProgress = false
$.fn.scrollToTop = function(position){
var $this = this,
targetY = position || 0,