Skip to content

Instantly share code, notes, and snippets.

View yankchina's full-sized avatar
💭
Researching and Learning

yankchina yankchina

💭
Researching and Learning
View GitHub Profile
@yankchina
yankchina / merge_dulplicate_value_in_one_column.vba
Last active August 20, 2016 09:17
将Excel中某一列相同数值合并居中
Sub 某列相同数值合并居中()
Application.DisplayAlerts = False
Dim i, j As Integer
Dim cel As String
col = Application.InputBox("请输入需要合并的列名(如A):")
i = 1
Value = Cells(1, col)
For j = 2 To Cells(Rows.Count, col).End(xlUp).Row
If Cells(j, col) <> Value Then
Range(Cells(i, col), Cells(j - 1, col)).Merge
@yankchina
yankchina / list.blade.php
Created June 27, 2016 16:03
laravel 输出表格
<?php $cols=['title'=>'名称','meeting_group_title'=>'类型','meeting_current_person_number'=>'人数','meeting_max_person_number'=>'限额','meeting_registration_start_date'=>'开始报名','meeting_registration_end_date'=>'结束报名','meeting_start_date'=>'开始日期','meeting_end_date'=>'结束日期','status_code'=>'状态']; ?>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>
</th>
@foreach ($cols as $key=>$col)
<td>{{$col}}</td>
@endforeach
<th>操作</th>
@yankchina
yankchina / list.blade.php
Created June 27, 2016 12:20
blade 中显示列表表格的方法
@foreach ($records as $index=>$record)
<tr>
<td>{{ ++$index }} /{{$record -> id}}</td>
<td>{{$record -> title}}</td>
<td>{{$record -> meeting_start_date}} - {{$record -> meeting_end_date}}</td>
<td>
<a href="#edit" class="btn blue btn-outline sbold" data-toggle="modal" id="{{$record -> id}}">Edit</a>
</td>
</tr>
@endforeach
@yankchina
yankchina / laravel-bootstrap-ajax.js
Last active June 25, 2016 12:08
用 laravel 5 框架做后台 + bootstrap(Modal)窗体做前台,Ajax 更改数据库表数据的方法
jQuery(document).ready(function() {
$('#edit').on('show.bs.modal', function (e) {
$id = e.relatedTarget.id; // 从触发按钮上获取到 id 号
// Ajax 获取数据,并且填充到表单中
$url = "/comment/api/one?id="+$id;
$.ajax({
type: "get",
url: $url,
dataType: 'json',
success : function(data){
@yankchina
yankchina / zhcn_endnote_label_generator
Created May 6, 2016 08:43
自动在 Endnote X7 For Mac 上为每个文献条目增加一个Label
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
filename: zhcn_endnote_label_generator
create datetime: 2016-05-06
author: yankchina@gmail.com
version: 1.0
description: >
@yankchina
yankchina / check_wifi_info.py
Created April 5, 2015 08:26
判定 Android 是否连上 WiFi,并且获取当前 IP 地址
import sl4a
import socket, struct
def check_wifi_info():
droid = sl4a.Android()
wifiState = droid.checkWifiState()
if wifiState:
ipdec = droid.wifiGetConnectionInfo().result['ip_address']
ipstr = socket.inet_ntoa(struct.pack('L',ipdec))
droid.makeToast(ipstr)
@yankchina
yankchina / format_xls_name.py
Created March 27, 2015 03:13
根据 cell 的类型来获取值,并转换为字符串
def get_cell_value(sheet,row,col):
# Cell Types: 0=Empty, 1=Text, 2=Number, 3=Date,4=Boolean,5=Error,6=Blank
cell_type = sheet.cell_type(row,col)
if 1 == cell_type:
value = sheet.cell_value(row,col)
if 2 == cell_type:
value = u"%s" %(sheet.cell_value(row,col))
return value
@yankchina
yankchina / capture.js
Last active August 29, 2015 14:16 — forked from shuuheyhey/capture.js
var screenshotUrl = 'http://example.com/'
var casper = require("casper").create({
viewportSize: {
width: 1280,
height: 1280
}
});
if (casper.cli.args.length < 1) {
@yankchina
yankchina / list.blade.php
Created February 7, 2015 10:17
php blade 模板中用嵌套循环来实现数组自定义字段输出
<div>
@foreach ($list_array as $key => $list_item)
<div>
@foreach ($column_array as $key => $column)
{{ $list_item[ $column ]}}
@endforeach
</div>
@endforeach
</div>
(function($) {
$(function() {
$('#returnData').html('');
$.ajax({
url: "./api/list.php",
success: function(data) {
$("#returnData").html(JSON.stringify(data));
}
});
}); // end of document ready