This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace OurSkyTestConsoleApp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpClient client = new HttpClient(); | |
client.BaseAddress = new Uri(@"https://www.google.com.tw"); | |
var response = await client.GetAsync(@"/"); | |
response.Content.Headers.ContentType.CharSet = "utf-8"; | |
//string result = await response.Content.ReadAsStringAsync(System.Text.Encoding.UTF8); | |
//string result = await response.Content.ReadAsStringAsync(); | |
byte[] byteArray = await response.Content.ReadAsByteArrayAsync(); | |
string result = System.Text.Encoding.UTF8.GetString(byteArray, 0, byteArray.Length); | |
result = System.Text.Encoding.GetEncoding("utf-8").GetString(byteArray); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<T> QueryBy(Dictionary<string, object> dic) | |
{ | |
string command = $"SELECT * FROM [User]"; | |
Dictionary<string, object> args = new Dictionary<string, object> | |
{ | |
{"ID1",0 }, | |
{"ID2",1 } | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (Type type in System.Reflection.Assembly.GetExecutingAssembly().ExportedTypes.Where(t => t.FullName.EndsWith("Service"))) | |
{ | |
if (!type.IsInterface) | |
{ | |
services.AddTransient(type.GetInterfaces().First(), type); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class UtilityFunction | |
{ | |
public static string GetUniqueId(string input) | |
{ | |
string result = string.Empty; | |
char[] chars = new char[] | |
{ | |
'a','b','c','d','e','f','g','h', | |
'i','j','k','l','m','n','o','p', | |
'q','r','s','t','u','v','w','x', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(1, 2525): | |
result = 0 | |
for j in range(1, 11): | |
if(0 == i%j): | |
result += 1 | |
if 10 == result: | |
print(i) | |
result = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
import twitter | |
import requests | |
import re | |
def get_magnet_link(url): | |
response = requests.get(url) | |
source_string = response.content | |
pattern = re.compile(r'(?<=id="a_magnet" href=")(.*?)">') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Table; | |
using System; | |
namespace Models | |
{ | |
public class BaseCloudTableModel | |
{ | |
protected CloudTableClient cloudTableClient; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CountDiv | |
{ | |
class Program | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MaxCounters | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
int[] A = { 3, 4, 4, 6, 1, 4, 4 }; | |
int n = 5; |
NewerOlder