Skip to content

Instantly share code, notes, and snippets.

@martin0258
martin0258 / gist:3731383
Created September 16, 2012 07:08
Setting used in visual studio add-in Vsvim (_vsvimrc)
set shiftwidth=2
set nu
set incsearch
set hlsearch
" Press Space to turn off highlighting and clear any message already displayed.
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
nmap <C-O> :vsc View.NavigateBackward<CR>
nmap <C-I> :vsc View.NavigateForward<CR>
nmap <C-]> :vsc Edit.GoToDefinition<CR>
@martin0258
martin0258 / gist:3731398
Last active October 10, 2015 18:18
gVim 7.3 personal initialization commands (_vimrc)
"Set my own variables
let s:ruby_path = 'C:/Ruby191/bin'
let g:Powerline_symbols = 'compatible'
let mapleader = ","
let g:mapleader = ","
let tabsize=2
let backupDir='~/VimBackup'
let g:EasyMotion_leader_key = '<Leader>'
let g:EasyMotion_mapping_n = '_n'
let g:EasyMotion_mapping_t = '_t'
@martin0258
martin0258 / gist:3749217
Created September 19, 2012 11:40
Gridview Select Row Without Using SELECT Button
/// <summary>
/// Three TODO on using this:
/// 1. AutoGenerateSelectButton = "true" on GridView1
/// 2. Handle OnSelectedIndexChanged event of GridView1
/// 3. Set selectedrowstyle
/// </summary>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
@martin0258
martin0258 / gist:3749234
Created September 19, 2012 11:45
Get the datakey value of the selected row in GridView
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
Console.WriteLine(((GridView)sender).SelectedValue.ToString());
}
@martin0258
martin0258 / InsertNotNull.py
Created November 2, 2012 05:45
Insert not null information to EA generated HTML Documentation for Data model using DDL
# -*- coding: utf-8 -*-
import sys
import re
import glob
import os
from HTMLParser import HTMLParser
class FileIndicator:
def __init__(self):
self.hasNotNull = False
@martin0258
martin0258 / gist:4093136
Created November 17, 2012 03:50
Google spreadsheet conditional formatting based on other cell
/**
* A installable trigger function (not simple event handler).
* It is automatically invoked whenever the spreadsheet is edited.
* It will highlight the leftmost cell of each status cell if the value of the status cell is equal to 'N'.
*
* For more information about two event systems (1. installable 2. simple event handler), see
* http://productforums.google.com/forum/#!topic/apps-script/liSC7PE_V3g
*/
function onChange(e)
{
@martin0258
martin0258 / ajaxtest.html
Created November 30, 2012 10:33
Simple asynchronous processing with jquery ajax
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Ajaxtest</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
// Test whether ajax call works or not
$(document).ready(function(){
$('#button').click(function(){
@martin0258
martin0258 / .bash_profile.sh
Created December 11, 2012 16:11
.screenrc and .bash_profile for linux
# Add a shortcut for frequently used directory
do=~/
umask 002
LANG=zh_TW.utf8
LC_ALL=zh_TW.utf8
alias cls='clear'
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# The following lines change the terminal settings for vim
stty start undef
stty stop undef
@martin0258
martin0258 / generate_windowing_transformation_sql.py
Last active December 16, 2015 09:08
Generate T-SQL for applying windowing transformation to time-series data.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2013 martinku <martinku@ss-martin-ku>
#
# Distributed under terms of the MIT license.
"""
Purpose:
@martin0258
martin0258 / gist:5671572
Created May 29, 2013 16:19
Time series plotting
# Plot multiple time series at one time
# Trick 1: use cut to rotate label values of y-axis
# Trick 2: use auto.key=list(space="inside") to make the legend be inside the panel.
ratings <- read.csv("Chinese_Weekday_Drama.csv", fileEncoding="utf-8")
xyplot(ts(ratings),superpose=TRUE,strip=FALSE,cut=1,
ylab="Rating",type="b",lwd=2,main="TV Rating Actual Data",
auto.key=list(space="inside"))