Skip to content

Instantly share code, notes, and snippets.

@jaydenlin
jaydenlin / Java - iterator
Created December 21, 2013 02:24
iterator in java
public static void foreach(Collection<String> collection) {
Iterator<String> iterator = collection.iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next());
}
}
@jaydenlin
jaydenlin / Set operation
Created December 21, 2013 02:32
Set operation
public static <T, E> Set<T> getKeysByValue(Map<T, E> map, E value) {
Set<T> keys = new HashSet<T>();
for (Entry<T, E> entry : map.entrySet()) {
if (value.equals(entry.getValue())) {
keys.add(entry.getKey());
}
}
return keys;
}
@jaydenlin
jaydenlin / gist:9636314
Last active October 20, 2021 17:55
hdf
<!-- saved from url=(0028)http://jaydenlin.tw/hdf.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<script>
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prev
@jaydenlin
jaydenlin / hdf-local
Created March 21, 2014 13:03
hdf-local-use
<!-- saved from url=(0028)http://jaydenlin.tw/hdf.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<style>
.fixed {
@jaydenlin
jaydenlin / HDF Extractor
Last active August 29, 2015 13:57
HDF Extractor
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<style>
.fixed {
@jaydenlin
jaydenlin / JS Animation
Created July 30, 2014 00:29
Test nomarlized
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<style>
#box{
width:100px;
height:100px;
border-radius:100px;
background-color:blue;
position:absolute;
}
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
@jaydenlin
jaydenlin / 0_reuse_code.js
Created August 25, 2014 02:45
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
def htmlTagToCsTag(doc, selector,csTag)
htmlTags=doc.css(selector)
index=0
for htmlTag in htmlTags
if index==0
htmlTag.replace(csTag)
else
htmlTag.remove
end
@jaydenlin
jaydenlin / server_hot_reload.js
Created January 3, 2016 19:37
Hot Reload Example
var http = require('http');
var express = require('express');
var path = require("path");
var app = express();
var Promise = require("bluebird");
var engine = require('express-partial-react-views');
require('node-jsx').install();
require('node-async-require').install({
preParser: "rt",