Skip to content

Instantly share code, notes, and snippets.

@xuniu
xuniu / 0_reuse_code.js
Created April 22, 2014 07:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xuniu
xuniu / build.gradle
Created April 18, 2014 07:48
android gradle
apply plugin: 'android'
buildscript {
repositories {
maven { url 'http://maven.oschina.net/content/groups/public/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
// the latest version of the android-apt plugin
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.1'
@xuniu
xuniu / build.gradle
Created April 18, 2014 07:47
JAVA 1.8 Gradle 应用程序
apply plugin: 'java'
apply plugin: 'application'
mainClassName='path.of.package.MainApp'
compileJava.options.encoding = 'UTF-8'
version = '1.0'
sourceCompatibility = '1.8'
@xuniu
xuniu / 聚合函数和第一个值.sql
Last active June 23, 2018 04:04
取聚合函数的值和每个分组的第一个元素
-- http://stackoverflow.com/questions/3800551/select-first-row-in-each-group-by-group
--On Oracle 8i+, SQL Server 2005+, PostgreSQL 8.4+, DB2, Firebird 2.1+, Teradata, Sybase, Vertica:
WITH summary AS (
SELECT p.id,
p.customer,
p.total,
ROW_NUMBER() OVER(PARTITION BY p.customer
ORDER BY p.total DESC) AS rk
FROM PURCHASES p)
@xuniu
xuniu / 滑动订单.sql
Last active August 29, 2015 14:00
滑动订单
--分钟实现
select
min(OccurTime) as beginTime,
max(OccurTime) as endTime,
max(RecvReqCount)-min(RecvReqCount) as reqcount
from gwserverperfdatas
where OccurTime >= utc_date()
group by floor(unix_timestamp(OccurTime )/60)
.star_bg {
background-image: url(http://www.zhangxinxu.com/study/201308/star.png);
height: 20px;
width: 120px;
overflow: hidden;
position: absolute;
left: 0;
}
.star {