Skip to content

Instantly share code, notes, and snippets.

View freeonterminate's full-sized avatar

HOSOKAWA Jun freeonterminate

View GitHub Profile
@freeonterminate
freeonterminate / FixTaskbarIconClick.pas
Last active November 30, 2017 03:15
Fix bug RSP-17322
unit FixTaskbarIconClick;
(*
* Fix RSP-17322
*
* USAGE:
* Just add FixTaskbarIconClick to the uses section.
*
* RSP-17322:
* Window minimize-restore via taskbar icon click is broken in
* all Windows flavours
@freeonterminate
freeonterminate / Unit2.pas
Created November 20, 2017 02:33
TText, TGridLayout の BeginUpdate / EndUpdate 利用
uses
System.Generics.Collections;
type
TOpenText = class(TText);
procedure TForm1.CreateRandomText;
var
x, y: Integer;
Text: TText;
@freeonterminate
freeonterminate / Base64.pas
Created October 27, 2017 06:30
Base64 Encode
(*
* 概要 Base64 にエンコード
* 引数 iSrc エンコードしたいストリーム
* iDest エンコード結果格納先
* iSepCount セパレータを入れる場所(32 なら 32 個エンコードした所で入る)
* iSep セパレータ
*)
procedure EncodeBase64(
const iSrc, iDest: TStream;
iSepCount: Integer = 0;
@freeonterminate
freeonterminate / OldPascal.pas
Last active October 5, 2017 06:18
昔の書き方だよ。
program Foo;
function Bar(N: Integer): Integer;
begin
if (N > 0) then
Bar := Bar(N - 1);
end;
begin
Bar(5);
@freeonterminate
freeonterminate / MVPCounter.dpr
Last active June 19, 2017 04:01
Show MVP List from Embarcadero web page.
(*
* This is sample code (My memorandum)
* System.Net.HttpClient.THttpClient class
*
* Programmed by HOSOKAWA Jun / twitter @pik
*)
program MVPCounter;
{$APPTYPE CONSOLE}
@freeonterminate
freeonterminate / StaticOverride.pas
Last active April 19, 2017 09:07
Delphi's static method override
program StaticOverride;
type
TFoo = class
public
class procedure Bar; virtual;
end;
TBar = class(TFoo)
public
@freeonterminate
freeonterminate / Base64.pas
Last active March 21, 2017 03:28
Base64 Encoder / Decoder By Asm
(*
* 概要 Base64 エンコード
* 引数 iSrc エンコードしたいストリーム
* iDest エンコード結果格納先
* iSepCount セパレータを入れる場所(32 なら 32 個エンコードした所で入る)
* iSep セパレータ
*)
procedure EncodeBase64(
const iSrc, iDest: TStream;
iSepCount: Integer = 0;
@freeonterminate
freeonterminate / Semicoronless.pas
Created November 11, 2016 08:27
Semicolonless Delphi
{$WARNINGS OFF}
begin
(procedure(F: array of const)begin end)([
// 定番のやつ
(function(const Count: Integer): Integer
begin
for Result := 0 to Count - 1 do
Writeln('Good-bye, semicolon world !')
end
@freeonterminate
freeonterminate / プログラム.dpr
Last active September 17, 2020 04:07
Object Pascal も進化してるよ(プログラムの内容は全く意味が無いよ)
program プログラム;
uses
System.SysUtils
{$IFDEF ANDROID}
, Androidapi.JniBridge
{$ELSEIF IOS}
, iOSapi.Foundation
{$ENDIF}
;
@freeonterminate
freeonterminate / IsATOK.pas
Created February 25, 2016 05:06
Is ATOK ?
function IsATOK: Boolean;
var
Name: JString;
begin
Result := False;
Name :=
TJSettings_Secure.JavaClass.getString(
TAndroidHelper.Context.getContentResolver(),
TJSettings_Secure.JavaClass.DEFAULT_INPUT_METHOD);