Skip to content

Instantly share code, notes, and snippets.

View edward-hsu-1994's full-sized avatar
💭
I may be slow to respond.

Edward Hsu edward-hsu-1994

💭
I may be slow to respond.
View GitHub Profile
@edward-hsu-1994
edward-hsu-1994 / TheColorAuto
Last active August 29, 2015 14:15
自動點擊
//程式世界(https://www.facebook.com/ProgramingTech)
//THE COLOR遊戲,自動點擊(http://game.ioxapp.com/color/)
var timer;
function C(){
var Temp = {};//空物件
$("#box").find("span").each(function(){
var color = $(this).css('backgroundColor');//取得背景色
var stop = $(this).css('display');//取得顯示
if(stop == "none"){//如果不顯示則表示遊戲結束
clearInterval(timer);//清除Timer
@edward-hsu-1994
edward-hsu-1994 / GetXuiteMedia
Last active August 29, 2015 14:15
取得Xuite隨意窩影音的真實位址與其他資訊
/*
Date:20141207
BY XPY
程式碼僅供參考,引用請標示本頁網址
*/
using System;
using System.Linq;
using System.Text;
using System.Xml;
using System.Collections;
@edward-hsu-1994
edward-hsu-1994 / Dailymation.cs
Created March 2, 2015 08:45
GetDailymationMedia
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Collections;
using Alex.Data;
using Alex.Syntax;
using Alex.Data.Json;
@edward-hsu-1994
edward-hsu-1994 / yield.js
Last active August 29, 2015 14:16
javascript使用yield模擬await功能
function requestAsync(path,thread){
var q = new XMLHttpRequest();
q.open('get','test.json');
q.onload = function(){
requestAsync['result'] = JSON.parse(q.response);
thread.next();//回呼
}
q.send();
}
@edward-hsu-1994
edward-hsu-1994 / yield async.cs
Last active August 29, 2015 14:17
C# yield download callback
//Xu Pei Yao - 2015/03/23 - 22:35
class Program {
static void DownloadHtml(string url,out string html,ref int time) {
string result = new WebClient().DownloadString(url);
lock(result) {
time--;
html = result;
if(time == 0)th.MoveNext();//跳脫點繼續
}
}
@edward-hsu-1994
edward-hsu-1994 / form1.cs
Created April 15, 2015 14:50
for eyny sample
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System;
namespace CPE
{
class Program{
public static void Main(string[] args){
decimal value = decimal.Parse("999999999999999999999");
Console.Write(Degree(value));
Console.ReadKey(true);
}
@edward-hsu-1994
edward-hsu-1994 / ChineseAndEnglishNumberConvert.cs
Last active August 29, 2015 14:24
整數數值 與 中文數字 與 英文數字 互相轉換(數值轉中文數字字串、中文數字字串轉數值)
//數字轉換為中文數字字串
public static class NumberExtension {
#region decimal的數學指數計算
public static decimal Power(decimal A ,decimal B) {
decimal Result = 1;
for(int i = 0; i < B; i++)
Result *= A;
return Result;
}
#endregion
@edward-hsu-1994
edward-hsu-1994 / ITSA 39.cs
Last active August 29, 2015 14:24
ITSA 39
//ITSA 39 - Problem_1重點函數
static int[] Problem_1(int Start) {
List<int> result = new List<int>();
do {
result.Add(Start);
if(Start % 2 == 0) Start /= 2;
else Start = Start * 3 + 1;
} while(Start != 1);
result.Add(1);
return result.ToArray();
@edward-hsu-1994
edward-hsu-1994 / inup.sql
Created July 15, 2015 04:13
Insert Or Update
DECLARE @UpdateTable table(--暫存表,用以暫時儲存要更新或新增的目標資料
[Id] int,
[Name] nvarchar(16),
[Count] int
)
insert @UpdateTable select Min([Id]),Min([Name]),Sum([Count]) from (--將要更新的資料寫入暫存表
select * from [test].[TableA]
union all
select * from [test].[TableB]
) as TempA group by [Id]