Skip to content

Instantly share code, notes, and snippets.

@akai
akai / vscode.settings.json
Created November 22, 2021 06:14
vscode.settings
{
"editor.fontSize": 16,
"editor.fontFamily": "'Fira Code'",
"editor.tabSize": 2,
"editor.fontLigatures": true,
"editor.rulers": [
80,
100
],
"editor.accessibilitySupport": "off",
@akai
akai / getGlobalVars.js
Created January 19, 2020 13:39
获取自定义的全局变量
(function() {
var keys = [];
var iframe = document.createElement('iframe');
iframe.onload = function() {
var iframeKeys = Object.keys(iframe.contentWindow);
Object.keys(window).forEach(function(key) {
if (!(iframeKeys.includes(key))) {
keys.push(key);
}
});
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.google.Chrome</key>
@akai
akai / idc.js
Created December 30, 2011 03:33
使用“标准”图片进行监控对比
// via http://www.infoq.com/cn/presentations/wh-dianping-web-develop-road
var idcUrl = 'http://domian.com/test.jpg?' + Math.random();
document.getElementById('top').innerHTML = '<img src="'
+ idcUrl + '" onload="idc(this.src, '
+ (new Date().getTime()) + ')" />';
function idc(url, start) {
var loadTime = new Date().getTime() - start;
@akai
akai / style.md
Created September 26, 2011 09:59
CSS Snippets

CSS Transitions & Gradients

Via An HTML5/CSS3 Case study – CV/Résumé

gradient

.transition-gradient {
  background: -webkit-linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
 background: -moz-linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
@akai
akai / script.md
Last active September 26, 2015 19:37
JavaScript Snippets

Load newest JQuery 1.x library from Google's CDN

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>

The Window Scroll Event

  • It's a very, very, bad idea to attach handlers to the window scroll event.
  • Always cache the selector queries that you're re-using.