Skip to content

Instantly share code, notes, and snippets.

View naoyeye's full-sized avatar
🦾

J.Y Han naoyeye

🦾
View GitHub Profile
controllers.controller('TabBarController',function TabBarController ($scope,$log,$http) {
var tabBarItem =$('#tabBar > .item');
var chatPanelOpen = false;
tabBarItem.click(function(){
var tabClass = $(this).data('tab');
if(!chatPanelOpen){
$('#wrapper').addClass(tabClass);
@naoyeye
naoyeye / doubanGreasemonkey.js
Created August 10, 2013 15:21
a Greasemonkey Script for douban, "赞" => "待阅","已赞" => "朕知道了"
// ==UserScript==
// @name IKnowIKnow
// @namespace IKnowIKnow
// @include http://*.douban.com/*
// @version 1
// @grant GM_setValue
// @grant GM_getValue
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==
@naoyeye
naoyeye / @chenyang.html
Created February 23, 2013 11:06
给陈扬写的表单验证
<!--form中的action需要增加你表单的提交地址,这样验证插件才能知道你的ajax往哪儿发: action="/record_email"-->
<form id="recordEmail" class="form-inline" method="post" enctype="multipart/form-data" accept-charset="utf-8" action="/record_email">
<!--.......-->
</form>
<script>
$('#recordEmail').Validform({
ajaxPost : true, //这里开启ajax提交
tiptype : function(msg,o,cssctl){
var objtip=o.obj.parents('#recordEmail').find(".Validform_checktip");
@naoyeye
naoyeye / Preferences.sublime-settings.py
Last active December 13, 2015 18:29
/Users/xxx/Library/Application Support/Sublime Text 3/Packages/User/Preferences.sublime-settings
{
"color_scheme": "Packages/Dracula Color Scheme/Dracula.tmTheme",
"draw_indent_guides": true,
"draw_white_space": "all",
"fade_fold_buttons": false,
"font_face": "Source Code Pro",
"font_size": 12.0,
"highlight_modified_tabs": true,
"ignored_packages":
[
#添加评论
class new_post_comment:
@session.login_required
def POST(self, pid):
data = web.input()
reg_regchar = '@([a-zA-Z0-9][\w\-\.\_]+)' #正则匹配username
comment = data.postComment
comment = htmlquote(comment).strip().replace("\r\n", "<br/>") #内容过滤
usernames = re.findall(reg_regchar, comment) #得到username数组
nicknames = []
import web
import app.controllers
from config import view
def notfound():
return web.notfound(view.error())
urls = (
'/post/(\+?[1-9][0-9]*)', 'app.controllers.post.post_show', #正则匹配url 验证非零的正整数
)
class post_image_delete:
@session.login_required
def POST(self, arg):
data = web.input()
path = data.path
part_name = data.part_name
homedir = os.getcwd()
imgPath = homedir + path
if os.path.isfile(imgPath + '/.DS_Store'):
import os
homedir = os.getcwd()
part_name = '201211981222_7a214d288112fe8ef99944aa7ce4d228'
path = '/static/upload/post_img/2012/11/9'
imgPath = homedir + path
if os.path.isfile(imgPath + '/.DS_Store'):
os.remove(imgPath + '/.DS_Store')
class post_image_delete:
@session.login_required
def POST(self, arg):
data = web.input()
path = data.path # 类似 '/static/upload/post_img/2012/11/9'
part_name = data.part_name # 类似 '201211981222_7a214d288112fe8ef99944aa7ce4d228'
homedir = os.getcwd()
imgPath = homedir + path
#上面组装的结果类似这样 : "/home/www/rhinocero" + "/static/upload/post_img/2012/11/9"
@naoyeye
naoyeye / Awesome Screenshot
Created September 14, 2012 11:06
Awesome Screenshot > resouces > as-ff > lib > ui.js
function capture(option) {
var window = mediator.getMostRecentWindow("navigator:browser")
//为了在v2ex显示方便,这里加了个回车
.gBrowser.contentWindow;
var document = window.document;
var html = document.documentElement;
var w, h, x, y;
switch(option) {
case 'visible':
x = 0;