Skip to content

Instantly share code, notes, and snippets.

View kokdemo's full-sized avatar

kok liu kokdemo

View GitHub Profile
@kokdemo
kokdemo / flomo-zen-mode.css
Last active January 7, 2021 07:45
flomo-zen-mode
/* 如何使用? */
/* 使用stylus之类的浏览器插件,把css加载进去就行了,喜欢的话来个star */
.input-box:focus-within{
border: 2px solid #55BB8E!important;
position: relative;
z-index: 5;
}
.search:focus-within{
@kokdemo
kokdemo / Boxforkodi.md
Last active September 4, 2019 02:02
Box for kodi

看起来还行

  • 斐讯T1&N1
  • 小米盒子海外版

其他选择

  • 泰捷盒子
  • 海美迪
  • 企鹅极光盒子 1s

靠谱但是贵

@kokdemo
kokdemo / rgb2hsb
Created July 27, 2015 02:06
rgb<--->hsb
/// <summary>
/// HSB用float数据类型表示
/// </summary>
static void RGB2HSB(int r, int g, int b, out float hue, out float sat, out float bri)
{
int minval = Math.Min(r, Math.Min(g, b));
int maxval = Math.Max(r, Math.Max(g, b));
//bri
bri = (float)(maxval + minval) / 510;
@kokdemo
kokdemo / tel.cn.js
Created July 22, 2015 08:50
判断中国所有运营商的js
//判断手机号
var mobilecheck = function(tel){
var result = {
isMobile:false,
number:tel.toString(),
operator:'unknown'
};
if(/^13[5-9]\d{8}$/g.test(tel) ||
/^134[0-8]\d{7}$/g.test(tel) ||
/^147\d{8}$/g.test(tel) ||
@kokdemo
kokdemo / 100-same-tree
Last active August 29, 2015 14:18
leecode-js
// 这里用递归的方法来匹配两个二叉树,需要注意的是,要在判断之前,先判断这个值是否存在
/**
* Definition for binary tree
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
@kokdemo
kokdemo / dribbble.js
Created January 6, 2015 03:50
一个用于快速follow dribbble上人的脚本,当你在看一个人的following 的时候可以使用
var array= $('.player-cards').children();
var length = array.length;
for(i=0;i<length;i++){
var url = 'https://dribbble.com'+$(array[i]).children('.player-info').children('.follow-prompt').children('.follow').attr('href');
console.info(url);
$.post(url);
}
var weburl = window.location.href;
var page = parseInt(weburl.split('=')[1])+1;
@kokdemo
kokdemo / ai.js
Last active August 29, 2015 14:11
code game AI
/**
* Created by kokdemo on 14/12/7.
*/
var lastPosition = null;
function turnDirection(dir,callback){
var dirs = ['up','right','down','left'];
var turnFunc = {
up: {up: false, right:'left', down:'right',left:'right'},
right:{up:'right',right: false, down:'left', left:'right'},
function cheat() {
var color1, color1box, color2, color2box;
var boxes = document.querySelectorAll('#box > span'),
boxLen = boxes.length;
for (var i = 0; i < boxLen; i++) {
var box = boxes[i],
color = box.style.backgroundColor;
if (i == 0) {
color1 = color;
color1box = box;