Skip to content

Instantly share code, notes, and snippets.

@josephj
josephj / 2013-hehuan-hiking.md
Last active December 13, 2015 20:28
2013 春節清境、合歡山旅遊

2013 春節清境、合歡山旅遊

  • 日期:2013/2/15-16
  • 地圖:http://goo.gl/maps/n6H99
  • 開放路肩行駛:
  • 國 3「竹林」至「關西」北上:89K+800 - 81K+400。
@josephj
josephj / css3-display-table.html
Created February 19, 2013 03:59
CSS3 - display:table
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="josephj">
<meta name="created" content="2013-02-19">
<title>CSS3 - display:table</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssfonts/fonts-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssbase/base-min.css">
@josephj
josephj / array_merge_recursive_distinct.php
Last active September 10, 2023 07:52
Useful PHP script when you want to merge multiple arrays like Y.merge().
<?php
/**
* Copy from http://www.php.net/manual/en/function.array-merge-recursive.php#92195
*
* array_merge_recursive does indeed merge arrays, but it converts values with duplicate
* keys to arrays rather than overwriting the value in the first array with the duplicate
* value in the second array, as array_merge does. I.e., with array_merge_recursive,
* this happens (documented behavior):
*
* array_merge_recursive(array('key' => 'org value'), array('key' => 'new value'));
@josephj
josephj / split_combo_url.js
Last active December 14, 2015 09:08
Splits your combo URL if its length exceeds the max length limitation.
function splitUrl(base, files, separator, maxLength) {
base = base || "/";
files = files || [];
separator = separator || ",";
maxLength = maxLength || 1024;
var items = [],
results = [],
url = base + files.join(separator),
@josephj
josephj / key-event-with-swf.html
Last active December 14, 2015 10:49
SWF swallows any JavaScript key events while it's focused. This demo illustrates how to make key events always work while SWF exists on page.
<!DOCTYPE html>
<html>
<head>
<title>SWF & JavaScript Key Event</title>
<style>
#focusable-link {
position: absolute;
left: -1000em;
top: -1000em;
}
@josephj
josephj / install-sublime2-package-control.py
Created March 4, 2013 00:07
Install Package Control for Sublime Text 2
import urllib2,os;
pf='Package Control.sublime-package';
ipp=sublime.installed_packages_path();
os.makedirs(ipp) if not os.path.exists(ipp) else None;
urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler()));
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read());
print 'Please restart Sublime Text to finish installation'
@josephj
josephj / ajax-xdr.html
Created March 7, 2013 06:37
Cross-domain testing.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XMLHttpRequest Cross Domain</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
@josephj
josephj / focus-auto-scroll.php
Last active December 16, 2015 03:19
Focus Auto Scroll Effect for WebView. ( http://lab.josephj.com/2013/anim-focus-scroll/demo.php )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="josephj">
<meta name="created" content="2013-04-10">
<title>Focus Auto Scroll</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssreset/reset-min.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/3.7.2/build/cssfonts/fonts-min.css">
<script type="text/javascript" src="http://yui.yahooapis.com/3.7.2/build/yui/yui-min.js"></script>
@josephj
josephj / .jshintrc
Created April 16, 2013 07:26
miiiCasa 的 JSHint 設定,還需要再討論。
/**
* JSHint options: http://www.jshint.com/docs/#options
*/
{
"bitwise": true,
//"camelcase": true,
"curly": true, // Disallows curly.
"eqeqeq": true,
"forin": true,
"immed": true,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Position</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">