Skip to content

Instantly share code, notes, and snippets.

View norfish's full-sized avatar
🎯
Focusing

李永翔 norfish

🎯
Focusing
View GitHub Profile
@norfish
norfish / select.jsx
Last active August 29, 2015 14:18 — forked from jbottigliero/select.jsx
/** @jsx React.DOM */
define(['reactjs'], function(React){
return React.createClass({
getDefaultProps: function(){
return {
multiple: false
/*
name: 'mySelect'
@norfish
norfish / hngen.py
Created November 29, 2013 02:42 — forked from grantslatton/hngen.py
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@norfish
norfish / IE mode
Created December 4, 2013 03:50
IE mode
```
<meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Demo | Yesol</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style>
@norfish
norfish / keyboard.js
Created July 15, 2016 11:37
keyboard events - rn
//安卓不支持willShow方法,统一在didShow中处理
RCTDeviceEventEmitter.addListener(Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow', evt=> {
if (!writeStore.isLoggingin) {
dispatcher.dispatch({
namespace: 'write',
action: 'keyboardShow',
data: {
keyboardHeight: evt.endCoordinates.height
@norfish
norfish / isElementVisible.js
Last active May 19, 2017 08:59
判断元素在是否在可视区域 check element in viewport(include part of)
// include part of the element
// 包含元素的一部分区域在可以区域
function isElementVisble(el) {
if(!el) {
return;
}
var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var elPos = el.getBoundingClientRect();
@norfish
norfish / ios-scroll.js
Created October 23, 2017 09:21
ios-scorll for not overflow
/**
* author: fa-ge
* github: https://github.com/fa-ge/LocalScrollFix
*/
;(function() {
function createHeadTag() {
var styleNode = document.createElement('style')
styleNode.className = 'localscrollfix-head'
document.head.appendChild(styleNode)
@norfish
norfish / toast.js
Created January 25, 2018 11:33
移动端touch toast,依赖 jquery
/**
* @desc: Toast
* @authors: yongxiang.li
* @date: 2016-08-10 18:49:05
*
* Toast('message')
*/
// TODO 增加位置自定义
#!/bin/sh
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 1024
@norfish
norfish / javascript
Created July 30, 2018 07:44
tiny xhr-ajax
const tinyAjax = function tinyAjax(config) {
return new Promise((resolve, reject) => {
let request = new XMLHttpRequest()
request.open(config.method.toUpperCase(), config.url, true)
request.timeout = config.timeout || 60000
// Listen for ready state
request.onreadystatechange = function handleLoad() {
if (!request || (request.readyState !== 4)) {
return;
}