Skip to content

Instantly share code, notes, and snippets.

View JonasGao's full-sized avatar
🙂
Cured ! Thanks God

Jonas Gao JonasGao

🙂
Cured ! Thanks God
  • Earth
  • Big Data
View GitHub Profile
@JonasGao
JonasGao / $q.js
Last active February 25, 2017 15:58
angular 1.x $q service 的学习记录,笔记就在 $q 的源代码文件中。后面两个 html 是实验文件
'use strict';
/**
* @ngdoc service
* @name $q
* @requires $rootScope
*
* @description
* A service that helps you run functions asynchronously, and use their return values (or exceptions)
* when they are done processing.
@JonasGao
JonasGao / adaptiveCenter.kt
Last active June 19, 2017 10:47
Adaptive centering picture (Based on Java. Writing with Kotlin)
package com.voyageone.components.s7.template.analysis.viewer
import java.awt.image.BufferedImage
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStream
import javax.imageio.ImageIO
fun adaptiveCenterAsStream(imageInputStream: InputStream, size: String): InputStream = adaptiveCenterAsImage(imageInputStream, size).let {
val os = ByteArrayOutputStream()
package org.jonas.test;
public class NumberRange {
private int lower = 1, upper = 50;
public int getLower() { return lower; }
public int getUpper() { return upper; }
public void setLower(int value) {
if (value > upper)
@JonasGao
JonasGao / index.html
Created August 18, 2017 16:46
What does the file last show?
<!DOCTYPE html>
<html>
<body>
<section>
Hello World
</section>
<script>
document.write("Im Writing some thing")
</script>
<section>
@JonasGao
JonasGao / proxy.minimal.conf
Last active January 25, 2023 22:22 — forked from sirsquidness/proxy.conf
How to have nginx proxy_pass follow upstream 302 redirects (Minimal, without Cache
server {
listen 80;
charset utf-8;
location / {
proxy_pass http://web;
proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirects;
}
@JonasGao
JonasGao / dva.util.ts
Last active October 24, 2018 03:38
make better type for dva
import { Action, AnyAction } from "redux"
type creator = (payload?: any, withNamespace?: boolean) => Action
type Creators<T> = {
[P in keyof T]: creator
};
interface Model<S, E, R> {
namespace: string,
@JonasGao
JonasGao / idea.vmoptions
Last active November 24, 2018 16:18
IDEA G1 GC 2g 内存版本 vmoptions
-server
-ea
-Xmx2g
-Xms1g
-XX:+UseG1GC
-XX:-UseParNewGC
-XX:-UseConcMarkSweepGC
-XX:ReservedCodeCacheSize=256m
-XX:+OmitStackTraceInFastThrow
-Dsun.io.useCanonCaches=false
**
* 用于比较属性的帮助方法。应该仅在开发时使用
*/
export const helper = {
cache: {},
diff(key: string | number, ...args) {
const latestArgs: any[] = this.cache[key];
if (!latestArgs) {
this.cache[key] = args;
return
@JonasGao
JonasGao / init-html5.html
Created April 30, 2019 09:39 — forked from shabith/init-html5.html
HTML5: Starting Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title></title>
</head>
<body>
@JonasGao
JonasGao / App.java
Last active June 12, 2019 06:07
用来从 excel 生成 pojo
package com.tools;
import org.apache.poi.ss.usermodel.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;