Skip to content

Instantly share code, notes, and snippets.

View edwinyzh's full-sized avatar

Edwin Yip edwinyzh

View GitHub Profile
@CynicRus
CynicRus / gist:8f5d213d16c9b9eb75ef13dbd9bfa273
Created October 23, 2020 09:44
Golang tokenizer on Freepascal
unit utokenizer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
const
@gabr42
gabr42 / MetaClassCache.dpr
Last active February 1, 2019 15:18
class properties as per-type cache
program MetaClassCache;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.TypInfo,
System.SysUtils;
unit UDebouncedEvent;
interface
uses
System.Classes, System.SysUtils, System.DateUtils, FMX.Types;
type
TDebouncedEvent = class (TComponent)
private
@WeiChiaChang
WeiChiaChang / progress.html
Created July 26, 2017 10:08
Simple Pure CSS Progress Bar
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta chatset="UTF-8" />
<title>CSS Progress Bar</title>
<style>
.wrapper {
width: 500px;
}
type
TObjectHelper = class helper for TObject
public
class function &&op_LogicalOr<T: class>(A, B: T): T; static;
end;
class function TObjectHelper.&&op_LogicalOr<T>(A, B: T): T;
begin
if A <> nil then
Result := A
@superswanman
superswanman / Project1.dpr
Created September 11, 2016 16:04
Use operator overloading for classes with non-ARC compiler
program Project1;
{$APPTYPE CONSOLE}
uses
System.SysUtils, System.Classes, System.Types, Vcl.Dialogs;
type
TStringListEx = class(TStringList)
public
@UweRaabe
UweRaabe / Unit77.pas
Last active April 7, 2016 17:26
Screenshot to Metafile
unit Unit77;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Actions, Vcl.ActnList;
type
TForm77 = class(TForm)
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@manigandham
manigandham / rich-text-html-editors.md
Last active May 3, 2024 19:37
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.