Skip to content

Instantly share code, notes, and snippets.

View phongaster's full-sized avatar
🎯
Focusing

フォン phongaster

🎯
Focusing
View GitHub Profile
@phongaster
phongaster / ChangeAnnotationAtRuntime.java
Created June 2, 2019 15:28 — forked from henrrich/ChangeAnnotationAtRuntime.java
Modify annotation at runtime, java 8 support
public final class RuntimeAnnotations {
private static final Constructor<?> AnnotationInvocationHandler_constructor;
private static final Constructor<?> AnnotationData_constructor;
private static final Method Class_annotationData;
private static final Field Class_classRedefinedCount;
private static final Field AnnotationData_annotations;
private static final Field AnnotationData_declaredAnotations;
private static final Method Atomic_casAnnotationData;
private static final Class<?> Atomic_class;
@phongaster
phongaster / Factor.cls
Last active May 20, 2019 17:17
VBA Factor
Option Explicit
Private FactorName_ As String
Private Levels_ As Collection
Public Property Get Levels() As Collection
Levels = Levels_
End Property
Public Property Let Levels(ByVal value As Collection)
@phongaster
phongaster / TestCaseGroup.cls
Created May 20, 2019 16:26
VBA TestCaseGroup
Option Explicit
Private TestCases_ As Collection
Private GroupID_ As Integer
Private Size_ As Integer
Public Property Get Size() As Integer
Size = Me.TestCases.Count
End Property
@phongaster
phongaster / Table.bas
Created May 20, 2019 16:25
VBA Table Utils
Public Sub AddRow()
Dim TestCases As Collection
Set TestCases = New Collection
Dim mTestCase As TestCase
Randomize
For i = 1 To 10
Set mTestCase = New TestCase
With mTestCase
.GroupID = Int(3 * Rnd + 1)
Option Explicit
Public Const Mname As String = "MyPopUpMenu"
Sub DeletePopUpMenu()
'Delete PopUp menu if it exist
On Error Resume Next
Application.CommandBars(Mname).Delete
On Error GoTo 0
End Sub
Option Explicit
Implements IClassTemplate
'******************************************************************************
' Purpose:
' Input:
' Output:
'******************************************************************************
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,1d,00,1d,00,3a,00,\
00,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\DosKeybCodes]
"00000402"="bg"
"00000404"="ch"
"00000405"="cz"
@phongaster
phongaster / ddd.md
Created March 20, 2019 06:53 — forked from zsup/ddd.md
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.
@phongaster
phongaster / CleanArchitecture.md
Created March 11, 2019 01:47 — forked from ygrenzinger/CleanArchitecture.md
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@phongaster
phongaster / clean_code.md
Created March 11, 2019 01:46 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules