Skip to content

Instantly share code, notes, and snippets.

@ringoluo
ringoluo / explain.sql
Created May 5, 2016 15:02
EXPLAIN SQL EXECUTION PLAN FOR ORACLE
Explain plan for SELECT * FROM MY_TABLE;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
@ringoluo
ringoluo / FileController.java
Last active May 8, 2016 03:32
Upload File with JSON
@Controller
public class FileController {
@RequestMapping(value = "upload", method = RequestMethod.POST)
@ResponseBody
public String uploadFile(@RequestBody Map<String, String> file) throws IOException {
System.out.println(file.get("name"));
System.out.println(file.get("content"));
byte[] fileContent = Base64.decodeBase64(file.get("content").split(",")[1]);
Files.write(fileContent, new File("/Users/ringoluo/Desktop/" + file.get("name")));
return "ok";
@ringoluo
ringoluo / mongodb.md
Created March 29, 2016 14:55
#mongodb cheat sheet

MongoDB cheat sheet

Overview

Overview

MongoDB is a document database that provides high performance, high availability, and easy scalability.

  • Document Database
@ringoluo
ringoluo / closure.txt
Created August 26, 2015 15:20
random notes from javascript ninja
##Define
scope
##Examples
private variables
--
object oriented
--
function Ninja() {
@ringoluo
ringoluo / dom.js
Created August 19, 2015 03:09
DOM.js from DOM Enlightenment
/**
* Created by Chun on 8/18/2015.
*/
(function (win) {
var global = win;
var doc = this.document;
var dom = function(params, context) {
return new GetOrMakeDom(params, context);
@ringoluo
ringoluo / SSLClient.java
Created July 21, 2015 00:54
SSL Java Demo
package com.company;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/**
* java
* -Djavax.net.ssl.trustStore=sslkeystore
* -Djavax.net.ssl.trustStorePassword=123456
@ringoluo
ringoluo / index.html
Last active August 29, 2015 14:24 — forked from anonymous/index.html
tags select box
<div ng-app="App">
<div ng-controller="MyCtrl">
<div class="tags">
<ul class="list-inline">
<li ng-repeat="item in items track by $index">
{{item}} <button ng-click="remove($index)">X</button>
</li>
<li style="position:absolute;">
<input class="silent" ng-model="keyword" ng-keypress="key($event)">
<ul ng-show="keyword">
@ringoluo
ringoluo / index.html
Last active August 29, 2015 14:17 — forked from anonymous/index.html
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ionic collection-repeat with variable height example</title>
<script src="http://code.ionicframework.com/1.0.0-rc.1/js/ionic.bundle.js">
</script>
<style>
.my-item > div {
border-style: solid;
@ringoluo
ringoluo / ngchange_rollback.js
Created February 25, 2015 08:46
AngularJS Rollback value with ng-change
$scope.$watch('color', function(newValue, oldValue) {
$scope.previousColor = oldValue;
});
$scope.changeColor = function(){
$http.put('...', {color: $scope.color}).error(function(){
$scope.color = $scope.previousColor;
});
};
@ringoluo
ringoluo / gulpfile.js
Last active August 29, 2015 14:15
Gulp+BrowserSync
var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('browser-sync', function() {
browserSync.init(['./*.html'], {
server: {
baseDir: "./"
}
});
});