Skip to content

Instantly share code, notes, and snippets.

using System.ComponentModel.DataAnnotations;
[MetadataType(typeof(MemberMetadata))]
public partial class Member
{
private class MemberMetadata
{
public int ID { get; set; }
[Required(ErrorMessage="Please input account")]
@elleryq
elleryq / idv.elleryq.library.continue.js
Created October 20, 2011 05:37
續借學校圖書
// ==UserScript==
// @name continue my library books
// @namespace idv.elleryq.library
// @description 續借學校圖書
// @include http://lib1.cute.edu.tw:81/cgi-bin/spydus?PG_NAME=BRW&UMODE=WRNWQ&ULG=CHI&UCODE=BIG5*
// ==/UserScript==
(function(){
var elements = document.getElementsByTagName("input");
for(var start=0,end=elements.length;start!=end;start++)
@elleryq
elleryq / stdinfosys_meterial_download.user.js
Created November 16, 2011 07:37
新增教材下載連結
// ==UserScript==
// @name 新增教材下載連結
// @namespace stdinfosys.meterial.download
// @description 新增教材下載連結
// @include http://192.192.78.86/stdinfosys/StudyMeterialDownload_V2.aspx*
// ==/UserScript==
(function(){
var elements = document.getElementsByTagName("div");
for(var start=0,end=elements.length;start!=end;start++)
{
@elleryq
elleryq / gist:1559502
Created January 4, 2012 10:37
RemoveSheetsButMe
Set objWorkbook = WScript.GetObject("d:\tmp\sample.xls")
Set objApp = objWorkbook.Application
sheetName = "Sheet1"
objApp.DisplayAlerts = False
count = objWorkbook.Worksheets.Count
for i=count to 1 step -1
if objWorkbook.Worksheets(i).Name <> sheetName then
objWorkbook.Worksheets(i).Select
objWorkbook.Worksheets(i).Delete
@elleryq
elleryq / expr-program.cs
Created February 8, 2012 10:38
ANTLR expr sample
/*
1. Visit http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases and download antlr-dotnet-tool-xxx.7z
2. unzip the 7z file.
3. Create solution in Visual Studio and add the following reference for the project: antlr3.runtime.dll.
4. Copy this file as program.cs
5. In unziped files, you can find antlr3.exe. Use it to generate necessary cs files: antlr3.exe expr.g3.
6. Add generated cs files to project.
7. Create folder 'sample' in the project and add a text file named Expr1.txt
8. Place the follow content in Expr1.txt, then change the property 'Copy to Output Directory' to "Copy always".
1+1
// ==UserScript==
// @name continue my library books 2
// @namespace idv.elleryq.library2
// @description 續借學校圖書
// @include http://192.192.83.170/webpac/member/MyLendList.jsp*
// ==/UserScript==
(function(){
// search all button named 'formExport' and push to list.
@elleryq
elleryq / web.config
Created May 11, 2012 03:35
web.config with phalanger
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file contains all possible configuration options processed by Phalanger and PHP native extensions.
The values stated here are the default ones. If you are creating a configuration for your application,
state only those options which differ from the default values.
Notes:
Some option nodes can have specified a "scope" attribute. This is a string having one of the values
' http://www.rgagnon.com/wshdetails/wsh-0018.html
' http://www.rgagnon.com/wshdetails/wsh-0002.html
' http://www.bernhard-ehlers.de/projects/OutlookSecurity.html
' Get full filepath from 1st argument
Dim Full_Filename
Dim Filename
Set objArgs = WScript.Arguments
if WScript.Arguments.Count=0 then
WScript.Quit 1
@elleryq
elleryq / gist:5795271
Created June 17, 2013 07:49
python doctest sample
def square(value):
"""
Multiple value 2 times.
>>> square(2)
4
>>> square(3)
9
"""
return value * value
@elleryq
elleryq / gist:5795302
Created June 17, 2013 07:54
Python unittest sample The sample comes from Pro Python Chapter 9
"""
The sample comes from Pro Python Chapter 9
The function: times2 is a module which contains a function.
def times2(value):
return value*2
"""
import unittest
import times2
class MultiplicationTestCase(unittest.TestCase):