Skip to content

Instantly share code, notes, and snippets.

View kirkchen's full-sized avatar

Kirk Chen kirkchen

View GitHub Profile
/// <summary>
/// IValidEntity
/// </summary>
public interface IValidEntity
{
/// <summary>
/// Gets or sets a value indicating whether this instance is valid.
// </summary>
/// <value>
/// <c>true</c> if this instance is valid; otherwise, <c>false</c>.
public static string Encrypt(string source, string key)
{
Encoding encoding = new UTF8Encoding();
byte[] encodeKey = encoding.GetBytes(key);
byte[] encodeSource = encoding.GetBytes(source);
using (HMACSHA512 sha512 = new HMACSHA512(encodeKey))
{
byte[] encryptSource = sha512.ComputeHash(encodeSource);

Keybase proof

I hereby claim:

  • I am kirkchen on github.
  • I am kirkchen (https://keybase.io/kirkchen) on keybase.
  • I have a public key ASA6QRr_UUdl8FgKoX496ya9X1ZoKy1IL_n3DFnNgjh2LAo

To claim this, I am signing this object:

@kirkchen
kirkchen / Async.ts
Created September 13, 2017 12:55
Why Typescript?
// Javascript
var a, b;
request('api.com/a', function(err, result){
if(err) {
// 錯誤處理
}
a = result;
request('api.com/b', function(err, result){
if(err){
@kirkchen
kirkchen / ajax.js
Created April 18, 2018 10:40
jQuery ajax sample
// 第一是把原本使用 callback 的程式碼抽離出來, 例如
$.ajax({
// 其他屬性
success: function,
error: function
});
//改成
@kirkchen
kirkchen / Install.md
Created June 10, 2018 05:12
Jenkins on Mac
  1. 安裝 Homebrew (如果安裝過可以略過)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. 安裝 Java (如果安裝過可以略過)
brew cask install java
@kirkchen
kirkchen / popclip-chatgpt.js
Last active March 26, 2023 10:04 — forked from alanzchen/popclip-chatgpt.js
PopClip Actions using ChatGPT.
// #popclip extension for ChatGPT
// name: ChatGPT Quick Actions
// icon: iconify:logos:openai-icon
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]