Skip to content

Instantly share code, notes, and snippets.

View jay16's full-sized avatar

俊杰.li jay16

View GitHub Profile
Request資訊收集
在Controller的Action之中,Rails提供了一些方法可以讓你得知此request各種資訊,包括:
action_name 目前的Action名稱
cookies Cookie 下述
headers HTTP標頭
把D:\test\目录下的所有jpg文件重命名为pic###.jpg的代码:
Dim i As Integer
i = 1
Set fs = CreateObject("scripting.filesystemobject")
Set fd = fs.GetFolder("d:\test")
For Each f In fd.Files
If LCase(f.ShortName) Like "*.jpg" Then
f.Name = "pic" & Format(i, "000") & ".jpg"
i = i + 1
End If
package a.a;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class AActivity extends Activity {
/** Called when the activity is first created. */
/**
*description:Android HttpPost()
*authour:YanEr·Gates
*website:http://www.gogogogo.me
*/
package me.gogogoog;
import java.io.IOException;
import java.util.ArrayList;
//常用到的sqlLite操作类,对增删查改进行了简单的封装。
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper {
static private DatabaseHelper mDbHelper;
@jay16
jay16 / js 套用公用计算
Created December 30, 2013 08:00
感觉算法上有好多地方可以优化,暂放,以备忘
<div>
<input type="text" id="input_value" onkeydown="enterIn(event);" />
<input type="button" value="计算" id="cal_btn" />
</div>
<div>
结果:<span id="ret_value"></span>
</div>
<div>
公式:<span id="ret_cal"></span>
</div>
@jay16
jay16 / bundle
Last active February 28, 2023 12:03
bundle install --path vendor/bundle
bundle install --path vendor/bundle
gem install rails -v 版本号
<div id="picture_show" style="position: absolute; display: none; background: none repeat scroll 0% 0% rgb(211, 211, 211); border-radius: 5px;z-index: 10000; ">
<img>
</div>
//picture show orginal size
$("#picture_list img").each(function(){
$img = $(this);
$tooltip = $("#picture_show");
$img.hover(
ctrl+a 跳到行首
ctrl+e 跳到末尾
ctrl+d 删除光标后1个字符
ctrl+h 删除光标前1个字符
ctrl+u 清除至行首
ctrl+k 清除至行尾
ctrl+f 光标后移1个字符
<!--
监视input输入为手机号
即输入内容为11位数字
-->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<input type="text" id="number">
<script>
function chk_phone_number(input) {
if(input.val().toString().match(/^[-]?[0-9]+[\.]?[0-9]*$/)==null ||