Skip to content

Instantly share code, notes, and snippets.

@tonyc726
tonyc726 / JqueryReady.js
Last active December 21, 2015 20:49
动态加载jQuery并等待载入完毕后回调mainFrom http://www.cbrother.com/html/1266.html
/*
动态加载jQuery并等待载入完毕后回调main
Author:McFog
*/
_unique_main = function() {
//maincode with jquery support
}//end of main
if(typeof $ != 'function' || typeof $().jquery != 'string') {
_unique_doc = document.getElementsByTagName('head')[0];
_unique_js = document.createElement('script');
@tonyc726
tonyc726 / 图片垂直居中.html
Last active December 22, 2015 08:38
使用CSS控制图片垂直居中From http://www.jb51.net/web/71728.html
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>图片垂直居中demo</title>
</head>
<style>
/*全局样式*/
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td, hr, button, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { margin: 0; padding: 0; }
body, button, input, select, textarea { font: 12px/1.5 Arial,"microsoft yahei","微软雅黑E\8F6F\96C5\9ED1"; }
@tonyc726
tonyc726 / auto_textarea.html
Last active December 23, 2015 17:19
模拟宽度自适应的输入框 From http://www.css88.com/demo/input-textarea-adaptive/
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
h2 { margin:0; padding:10px 0; font-size:14px; }
.mod-retweet { background:#E4EFF4; border:1px solid #A8D1E0; padding:3px 5px 5px; margin-top:5px; }
.mod-retweet .mod-retweet-textarea { background-color: #FFFFFF; border:1px solid #64B2D1; margin-bottom:5px; overflow:hidden; padding:2px; position:relative; zoom:1 }
.mod-retweet .mod-retweet-textarea textarea {padding: 0;margin: 0; border:0 none; font-size:12px; height:80px; line-height:1.5em; width:100%; display:block }
.mod-retweet .mod-retweet-textarea input { border:0 none; font-size:12px; height:20px; line-height:1.5em; width:100%; }
@tonyc726
tonyc726 / regex-weburl.js
Created November 11, 2013 08:43 — forked from dperini/regex-weburl.js
正则验证URL是否合法
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@tonyc726
tonyc726 / git_config.md
Last active January 8, 2019 17:35
Git 小记 -- 记录一些平时常用的git技巧

1.同一台电脑可以有2个git账号(不同网站的)

文件路径:~/.ssh/config

首先不同网站,当然可以使用同一个邮箱,比如我的github,gitlab,bitbucket的账号都是monkeysuzie[at]gmail.com 这时候不用担心密钥的问题,因为这些网站push pull 认证的唯一性的是邮箱 比如我的windows 上 2个账号一个gitlab 一个github (用的都是id_rsa)

host github
  hostname github.com

Port 22

@tonyc726
tonyc726 / Array.filter.md
Last active August 29, 2015 13:56
关于arrary.filter学习的一些积累

msdn Array.filter

[1,2,3,4].filter(function(a){
  console.log(this);
  console.log('a:'+a);
  return a!==this[0];
},[2]);
@tonyc726
tonyc726 / 360.html
Last active August 29, 2015 13:56
360浏览器设置Webkit内核
<html>
<head>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
</head>
<body>
</body>
</html>
@tonyc726
tonyc726 / django_charset.md
Last active August 29, 2015 14:01
django GBK 编码总结

django编码问题总结

环境

  1. diango 1.6*
  2. diango-compressor插件 1.4*

**切记:**必须要开始settings.py中的COMPRESS_ENABLED = True,否则编译会报错

HTML实验

@tonyc726
tonyc726 / fs_iconv_gbk.js
Created May 17, 2014 09:58
nodeJS小记
var fs = require('fs');
var iconv = require('iconv-lite');
fs.readFile('./a_uft8.md', function(err, data) {
if (err) {
console.error(err);
} else {
var str = iconv.decode(data, 'utf-8');
var str2 = iconv.encode(str, 'gbk')
var str3 = iconv.decode(str2, 'gbk')