Skip to content

Instantly share code, notes, and snippets.

@Jimco
Jimco / gist:69ab70a02f24518706c9173728396ec2
Created August 4, 2016 03:42 — forked from aisk/gist:3735854
百度地图坐标与像素互相转换的方法
pixelToPoint = function(point, zoom, center, bounds) {
// 像素到坐标
if (!point) {
return
}
var zoomUnits = getZoomUnits(zoom);
var mercatorLng = center.lng + zoomUnits * (point.x - bounds.width / 2);
var mercatorLat = center.lat - zoomUnits * (point.y - bounds.height / 2);
var mercatorLngLat = {lng: mercatorLng, lat: mercatorLat};
return mercatorToLngLat(mercatorLngLat)
@Jimco
Jimco / angularjs-providers-explained.md
Last active August 29, 2015 14:27 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@Jimco
Jimco / img_middle.html
Last active August 29, 2015 14:01
未知宽高文字/图片,水平垂直居中解决方案
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vertically centring in css</title>
<style>
.imgbox{display:table-cell; width:200px; height:200px; text-align:center; vertical-align:middle; *display:block; *position:relative; margin:20px auto;border:1px solid #ccc;}
.imgbox div{margin:0; *position:absolute; *top:50%; *left:50%;}
.imgbox div img{vertical-align:middle; *position:relative; *top:-50%; *left:-50%;}
@Jimco
Jimco / html5reset.css
Last active August 29, 2015 14:01
CSS stylesheet template for media queries
/* MEDIA QUERIES */
/**
* Print styles.
*
* Inlined to avoid required HTTP connection: www.phpied.com/delay-loading-your-print-css/
*/
@media print {
* { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
-ms-filter: none !important; } /* Black prints faster: sanbeiji.com/archives/953 */
<!DOCTYPE html> <!-- HTML5 doctype 不区分大小写 -->
<html lang="zh-cmn-Hans-CN"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用IE最新版本和 Chrome -->
<meta name="renderer" content="webkit|ie-comp|ie-stand"> <!-- 360 浏览器内核控制 -->
<!--
content的取值为webkit,ie-comp,ie-stand之一,区分大小写,分别代表用webkit内核,IE兼容内核,IE标准内核。
@Jimco
Jimco / select-hack.html
Last active May 20, 2019 14:49
下拉菜单select样式 — 兼容IE6/IE7/IE8/火狐
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>兼容IE6/IE7/IE8/火狐---下拉菜单select样式兼容</title>
<style type="text/css">
body {background-color:#6C6;}
.sel-wrap{width:88px;height:29px;*background:#fff;background:#fff;*border:1px solid #b2b2b2;*padding:4px;*height:20px;}
.sel-inner{*border:0;*position:relative;*height:18px;*overflow:hidden;}
.so-sel{border:1px solid #b2b2b2;padding:4px 3px;font-size:12px;height:30px;width:89px;*width:88px;*margin:-1px;outline:none;}
function insertText(obj,str) {
if (document.selection) {
var sel = document.selection.createRange();
sel.text = str;
} else if (typeof obj.selectionStart === 'number' && typeof obj.selectionEnd === 'number') {