Skip to content

Instantly share code, notes, and snippets.

View iahu's full-sized avatar
🌴
On vacation

i18u iahu

🌴
On vacation
View GitHub Profile
@iahu
iahu / app.js
Last active October 18, 2019 11:07
const dgram = require('dgram');
const serverSocket = dgram.createSocket('udp4');
const multicastAddress = '224.0.0.50';
const multicastPort = 4321;
const serverPort = 9898;
var AqaraAccessoryFactory;
function startServer() {
@iahu
iahu / webpack.config.js
Created November 29, 2016 14:41
react webpack config file, witch babel and sass
{
"name": "webpack-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack",
"dev": "webpack-dev-server --devtool eval --progress --colors --hot --content-base build",
"test": "echo \"Error: no test specified\" && exit 1"
},
@iahu
iahu / vue.html
Last active November 4, 2016 06:44
Vue 数据绑定原理 简单实现
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<ul id="todo"></ul>
<body>
<script>
// a trick of load .config as JSON ;)
require.extensions['.config'] = require.extensions['.json'];
var gulp = require('gulp');
var rmdir = require('rmdir');
var browserify = require('gulp-browserify');
// var named = require('vinyl-named');
var uglify = require('gulp-uglify');
@iahu
iahu / tips.css
Created June 14, 2016 03:05
tiny tips module
.mo-tips {
position: fixed;
top: 50%;
left: 50%;
width: 240px;
/*min-height: 100px;*/
margin-top: -50px;
margin-left: -120px;
background-color: #fff;
@iahu
iahu / autoTimeString.js
Created May 31, 2016 10:00
最近更新时间
function zPad (n) {
var l = 2;
var z = new Array(l+1).join('0');
return (z+n).slice(-l);
}
function autoTimeString(s) {
s = '' + s.replace(/^\s+/,'').replace(/\s+$/, '');
if ( s.length === 10 ) {
s = s + '000';
@iahu
iahu / scopes.txt
Created March 28, 2016 10:16 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@iahu
iahu / pre-commit-eslint
Created March 11, 2016 10:42 — forked from linhmtran168/pre-commit-eslint
Pre-commit hook to check for Javascript using ESLint
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
@iahu
iahu / tips.css
Last active January 28, 2016 05:48
mobile-tips.js
.mo-tips {
position: fixed;
top: 50%;
left: 50%;
width: 240px;
/*min-height: 100px;*/
margin-top: -50px;
margin-left: -120px;
background-color: #fff;
@iahu
iahu / safari-touchemulator.user.js
Created December 17, 2015 14:58
emulate touch events of safari(with iOS userAgent)
// ==UserScript==
// @name emulator_touch_events
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author author (uses https://github.com/hammerjs/touchemulator)
// @match http://tampermonkey.net/index.php?version=3.13.4890&ext=G3XV&updated=true
// @match *://*/*
// @grant none
// ==/UserScript==