Skip to content

Instantly share code, notes, and snippets.

View 01) Happy CSSer - 1.md
@Rplus
Rplus / .gitignore
Last active Jan 1, 2018
Pokamon CP[2018-01]
View .gitignore
*.map
prepros-6.config
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>max CP by level Pokémons</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<h1 class="intro">Pokémons' CP calculator<small>vue version</small></h1>
@Rplus
Rplus / css-variables-width-x-height-area-1-2.markdown
Last active Nov 6, 2017
CSS Variables: width x height = area (1/2)
View css-variables-width-x-height-area-1-2.markdown
@Rplus
Rplus / Happy-CSSer-cover.html
Created Aug 25, 2017
Happy CSSer custom cover
View Happy-CSSer-cover.html
<html>
<head>
<style id="webmakerstyle">
.cover {
position: relative;
width: 1000px;
height: 524px;
margin: 0 auto;
@Rplus
Rplus / bling.js
Created Jul 12, 2017 — forked from paulirish/bling.js
bling dot js
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
View Spread Operator.md

Calling Functions without Apply

function doStuff (x, y, z) { }
var args = [0, 1, 2];
doStuff(...args);
function doStuff(x, y, z) {}
var args = [0, 1, 2];
View geo-test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script>
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition(function(position) {
View levelCpMultiplier.json
{
"1": 0.094,
"1.5": 0.135137432,
"2": 0.16639787,
"2.5": 0.192650919,
"3": 0.21573247,
"3.5": 0.236572661,
"4": 0.25572005,
"4.5": 0.273530381,
"5": 0.29024988,
@Rplus
Rplus / isBackwards.js
Last active Nov 25, 2016
detection for the direction of selecting text
View isBackwards.js
// ref: http://stackoverflow.com/a/16265811
// 用 createRange 創一新的選擇範圍來判斷圈選的方向性
// anchorNode 是開頭圈選的 node, focusNode 是停止圈的位置
// 當圈選起始點在後面,那這個生成的 range 會壓縮成一個疊合的位置,`range.toString()` 時會變成空字串 ''
// 不過我這邊調整了一下,直接輸出 rg.collapsed 比較原生,不用再轉一次 `toString()`
function isBackwards (sel) {
var rg = document.createRange();
rg.setStart(sel.anchorNode, sel.anchorOffset);
rg.setEnd(sel.focusNode, sel.focusOffset);
return rg.collapsed;