Skip to content

Instantly share code, notes, and snippets.

@b2977053
b2977053 / gist:b36bc560dd3bd0e9ab8c5ae8c5ec6548
Last active November 12, 2019 02:07
改版(〃∀〃) 保哥出作業 JS
(function() {
window.$ = function(n) {
var num="undefined"==typeof n||null===n?0:n;
return {
add: function(n) { num += n; return this; },
result: function() { return num; }
};
}
})();
@b2977053
b2977053 / Default (OSX).sublime-keymap
Created May 17, 2019 03:52 — forked from beaugunderson/Default (OSX).sublime-keymap
Sublime Text macros for converting to and from 2 and 4 space indentation
[
{
"keys": ["ctrl+2"],
"command": "run_macro_file",
"args": {
"file": "Packages/User/to-2.sublime-macro"
}
},
{
"keys": ["ctrl+4"],
@b2977053
b2977053 / gist:b8f95a0367bdc552b5e0a645d29065a2
Last active October 25, 2019 07:04
比較三個 Excel轉ODS檔案 or HTML轉Excel檔案
string Content = getContent("http://localhost/xxx");
byte[] byteArray = Encoding.UTF8.GetBytes(Content);
MemoryStream stream = new MemoryStream(byteArray);
#region Spire.Xls 不支援讀取HTML
//https://www.e-iceblue.com/forum/html-to-excel-xls-t7246.html
//Spire.Xls.Workbook Spire_book = new Spire.Xls.Workbook();
//Spire_book.LoadFromStream(stream, Spire.Xls.ExcelVersion.ODS); // System.InvalidOperationException: 'This is not a structured storage file.'
PRINT CHARINDEX('B', 'A-B-C-D-E', 4); -- 0
PRINT CHARINDEX('B', 'A-B-C-D-E'); -- 3
PRINT SUBSTRING('A-B-C-D-E-F', 3, 1); -- B
PRINT SUBSTRING('A-B-C-D-E-F', 3, 2); -- B-
PRINT SUBSTRING('A-B-C-D-E-F', 3, 3); -- B-C
--gmail.com
DECLARE @Email NVARCHAR(100);
SET @Email = '[email protected]';
PRINT SUBSTRING(@Email, ( CHARINDEX('@', @Email) + 1 ),( LEN(@Email) - CHARINDEX('@', @Email) )); -- gmail.com
PRINT REPLICATE('A--', 3) -- A--A--A--
-- 補零
DECLARE @C1 varchar(4) = '12';
PRINT DATALENGTH(@C1) -- 2
PRINT REPLICATE('0', 4 - DATALENGTH(@C1)) + @C1 -- 0012
PRINT PATINDEX('%en_ure%', 'please ensure the door is locked'); --8
PRINT PATINDEX('%ein%', 'Das ist ein Test' COLLATE Latin1_General_BIN); --9
DECLARE @f FLOAT, @d MONEY, @i INT
SET @f = 1234567890.12
SET @d = 1234567890.12
SET @i = 1234567890
SELECT @f, CONVERT(varchar, @f), '-'+STR(@f,13, 2)+'-'
SELECT @d, CONVERT(varchar, @d), '-'+STR(@d,13, 2)+'-'
SELECT @i, CONVERT(varchar, @i), '-'+STR(@i,13, 2)+'-'
using Aspose.Cells;
using System;
using System.Drawing;
namespace test_Aspose_Cells
{
internal class Aspose_Cell_Style
{
internal void Background()
{
internal class 使用同步製作Pizza
{
private static int Pizza總數 = 0;
internal void 開始()
{
var watch = Stopwatch.StartNew();
Console.WriteLine("開始進行製作披薩...");
// 製作10個披薩 993 時間