Skip to content

Instantly share code, notes, and snippets.

View nocb's full-sized avatar

hansen nocb

View GitHub Profile
@nocb
nocb / 0_reuse_code.js
Created October 10, 2016 09:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nocb
nocb / smtp
Created October 10, 2016 09:23
python send qq mail
#!/usr/bin/python
#-*-coding:utf-8-*-
import smtplib
from email.mime.text import MIMEText
_user = "78713865@qq.com"
_pwd = "授权码" #需要到qq邮箱里面,设置-》账户中设置
_to = "78713865@qq.com"
@nocb
nocb / gist:866e1f3c604838ba070a
Last active August 29, 2015 14:14
button 状态编号 ng-class
<button ng-init="num=0; classes=['btn btn-success', 'btn btn-primary','btn btn-warning'] " ng-click="num = num + 1" ng-class="classes[num % classes.length]">Test </button>
<button id="btn" ng-click="toggle = !toggle" ng-class="{'red' : toggle}">Change Class</button>
@nocb
nocb / gist:a1b5d51c7794d198c7ba
Last active August 29, 2015 14:13
angular ng-repeat parent index
<div ng-repeat="(fIndex, f) in foos">
<div>
<div ng-repeat="b in foos.bars">
<a ng-click="addSomething(fIndex)">Add Something</a>
</div>
</div>
</div>
<tr ng-repeat="space in spaces">
@nocb
nocb / gist:d00c454181ba8e0e37bb
Created January 11, 2015 04:48
Ubuntu Linux: Start / Restart / Stop Apache Web Server
Method #1: /etc/init.d/apache2 command examples
$ sudo /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 restart
$ sudo /etc/init.d/apache2 stop
Method #2: service command examples
$ sudo service apache2 restart
Method #3: upstart command examples
$ sudo start apache2
@nocb
nocb / gist:2a862c536de6542f66a0
Created December 5, 2014 02:03
python 中文处理
# -*- coding: utf-8 -*-