Skip to content

Instantly share code, notes, and snippets.

@oklai
oklai / dabblet.css
Created October 26, 2012 06:26 — forked from lensco/dabblet.css
box-shadow vs filter: drop-shadow
/**
* box-shadow vs filter: drop-shadow
*/
body {
background: #ddd;
font: 16px/1 sans-serif;
}
div {
margin: 100px;
@oklai
oklai / gist:5298706
Created April 3, 2013 05:40
How to not auto focus of the "always-on-top" window.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>How to not auto focus of the "always-on-top" window.</title>
</head>
<body>
test html
<script type="text/javascript">
setTimeout(function () {
@oklai
oklai / gist:5394379
Last active December 16, 2015 06:49
获取当前viewport的宽度
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Get Viewport Width</title>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
function getViewportWidth () {
@oklai
oklai / test1
Created April 19, 2013 07:48
移动设备下screen.width测试
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
<script type="text/javascript">
alert(screen.width);
</script>
</head>
@oklai
oklai / compiler.package.text
Last active December 19, 2015 23:29
Koala compiler data structure
{
// A version of the properties for displaying.
// @optional
// e.g. "Stylus"
"name": "My",
// The version of this extension.
// @type {String}
"version": "1.0.0",
@oklai
oklai / readme.md
Last active December 20, 2015 04:09
The performance test between use module.exports and Function.prototype in node.

Here my results

test1()
Time: 10578 ms
Memory: 30912 K

test2()
Time: test2: 10798 ms
Memory: 30956 K

@oklai
oklai / README.md
Last active January 9, 2019 10:11
TCTicketScript - 火车票自动查询工具

TCTicketScript

TCTicketScript是一段浏览器脚本,帮你自动查询火车票余票。

如何使用

  1. 请使用Chrome浏览器;
  2. 拖拽这个链接到你的书签栏,抢票工具,拷贝下面的代码;
javascript:var QPscript=document.createElement('script');QPscript.src='https://gist.github.com/oklai/6533698/raw/4c29378caebcc0fe9c80f2592f0951846ece1e04/TCTicketScript.js';document.body.appendChild(QPscript);
@oklai
oklai / 0_reuse_code.js
Created March 17, 2014 10:53
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
@oklai
oklai / retina-sprite.scss
Created May 7, 2014 06:29
Retina sprite for Compass
@import "compass/utilities/sprites"; // Include compass sprite helpers
@import "compass/css3/background-size"; // Include helper to calc background size
// background sprite for retina
// Use:
// $sprites2x: sprite-map("sprites/*.png", $spacing: 2px);
// .icon-new {
// @include retina-sprite(icon-new, $sprites2x);
// }
@mixin retina-sprite($name, $sprites2x, $padding: 0) {
@oklai
oklai / co.js
Created December 31, 2014 03:40
co.js simple
'use strict';
/**
* co.js simple
*/
// api
//
// var co = require('co');
//