Skip to content

Instantly share code, notes, and snippets.

View androidzhibinw's full-sized avatar
😅
tired

zhibinw androidzhibinw

😅
tired
View GitHub Profile
@androidzhibinw
androidzhibinw / get_count.txt
Created December 22, 2015 08:47
use sed replce ; to \n and get the count with wc.
sed 's/;/\n/g' name-list.txt |wc
@androidzhibinw
androidzhibinw / update_checkout.sh
Last active December 25, 2015 06:38
update and checkout new branch each time.
#!/bin/bash
REMOTE=`git remote`
WORK_BRANCH="remotes/$REMOTE/android_ui.lnx.1.0-rel.1.1"
git remote update
echo "update done"
btime=`date +'%Y-%m-%d-%H-%M'`
#echo $WORK_BRANCH $btime
git checkout $WORK_BRANCH -b rel.1.1_$btime
@androidzhibinw
androidzhibinw / foo.log
Created January 15, 2016 02:57 — forked from ibeex/foo.log
Flask logging example
A warning occurred (42 apples)
An error occurred
@androidzhibinw
androidzhibinw / jqueryajax.post.js
Created January 20, 2016 01:58
jquery ajax post example
$(document).ready(function (){
$('#btn-send').click(function countdown(){
var phoneNumber = $('#phone').val()
$.ajax({
method: "POST",
url: "/getcode",
data: JSON.stringify({"number":phoneNumber},null,4),
contentType:'application/json;charset=UTF-8'
})
30 });
@androidzhibinw
androidzhibinw / input_number_disable_spin.css
Created January 20, 2016 06:50
disable input number spin
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
@androidzhibinw
androidzhibinw / json.py
Created January 20, 2016 10:48
construct json python
data = {}
data['key'] = 'value'
json_data = json.dumps(data)
@androidzhibinw
androidzhibinw / auto_format_python.sh
Created January 21, 2016 07:18
usage of autopep8
pip install autopep8
autopep8 your_script.py # dry-run, only print
autopep8 -i your_script.py # replace content
@androidzhibinw
androidzhibinw / model.py
Created January 21, 2016 08:16
sqlalchemy time created update
created_on = db.Column(db.DateTime, server_default=db.func.now())
updated_on = db.Column(db.DateTime, server_default=db.func.now(), onupdate=db.func.now())
@androidzhibinw
androidzhibinw / flask-flash-bootstrap
Created January 27, 2016 10:36 — forked from victorkristof/flask-flash-bootstrap
Flask flash messages as Bootstrap alert.
{% with messages = get_flashed_messages(with_categories=true) %}
<!-- Categories: success (green), info (blue), warning (yellow), danger (red) -->
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<!-- <strong>Title</strong> --> {{ message }}
</div>
{% endfor %}
{% endif %}
# -*- coding: utf-8 -*-