Skip to content

Instantly share code, notes, and snippets.

@haintwork
haintwork / arquillian-run-as-client.md
Created September 26, 2017 11:06
[Arquillian @RunAsClient] #arquillian #java #junit

To make @BeforeClass run setup method run after archive is deployed:

@BeforeClass
@RunAsClient
public void test() {
...
}
@haintwork
haintwork / angular2-constructor.md
Last active September 24, 2017 16:33
[Constructor type in Angular2] #angular2 #constructor
class User {
    id: string;
    constructor(public name: string,
                public avatarSrc: string) {
        this.id = uuid();
    }
}
@haintwork
haintwork / angular2-custom-validator.md
Created September 24, 2017 10:00
[Angular 2, custom validator] #angular2 #validator
function skuValidator(control: Control): {[s: string]: boolean} {
	if(!control.value.match('/^123/') {
    	return {invalidSku: true};
    }
}
@haintwork
haintwork / inno-setup-control-panel-icon.md
Created September 20, 2017 05:12
[Inno Setup Control Panel Icon] #inno_setup
[Seupt]
...
UninstallDisplayIcon={app}\{#MyAppExeName}
@haintwork
haintwork / inno-setup-check-registry-key-exist.md
Created September 20, 2017 04:05
[Inno Setup check for registry key exist] #inno_setup
[Code]
function InitializeSetup: Boolean;
begin
  // allow the setup to continue initially
  Result := True;
  if not RegKeyExists(HKLM, 'SOFTWARE\ABC\Option\Settings') then
  begin
    // return False to prevent installation to continue
 Result := False;
@haintwork
haintwork / angular2-sorted-array.md
Created September 16, 2017 03:35
[Angular2 Sorted Array] #angular2 #sort #js #javascript #typescript #ts #array
articles: Article[];
...
return this.articles.sort((a: Article, b:Article) => a.votes - b.votes); // ascending
return this.articles.sort((a: Article, b:Article) => b.votes - a.votes); // descending
``
@haintwork
haintwork / lepton-proxy.md
Created September 11, 2017 02:50
[Lepton: set proxy] #lepton

Create ~/.leptonrc (C:\Users\user_folder in case of Windows system) and paste this (replace address value):

{
  "proxy": {
    "enable": true,
    "address": "socks://localhost:1080"
  }
}
@haintwork
haintwork / Học ngoại ngữ nhanh và không bao giờ quên.md
Last active September 6, 2017 15:08
[Học ngoại ngữ nhanh và không bao giờ quên] #learning #foreign_language

Tài liệu

  1. Từ điển sắp xếp theo tần suất sử dụng
  2. Từ điển từ vựng phân loại theo chủ đề
  3. Sách các câu/cụm từ thông dụng

Phương pháp

  1. Làm cho ký ức đáng ghi nhớ hơn bằng cách sử dụng âm thanh, hình ảnh, liên kết cá nhân
  2. Tối đa hóa sự lười biếng, học càng ít càng tốt
  3. Tập nhớ lại chứ đừng xem lại
  4. Gợi lại ngắt quãng
@haintwork
haintwork / virtualbox-avt-x-not-availbale.md
Last active September 6, 2017 15:09
[Virtual Box AVT-X not available] #virtualbox
  1. Enable Virtualization in BIOS setup
  2. Disable Hyper-V feature (Control Panel > Programs and Features > Turn windows features on or off)
  3. Restart
@haintwork
haintwork / Rest-Assured Test Setup.md
Last active September 6, 2017 15:23
[Rest-Assured Test Setup] #java #rest #rest_assured #unit_test
public class FunctionalTest {
  
  @BeforeClass
  public static void setup() {
    String port = System.getProperty("server.port");
    if (port == null) {
      RestAssured.port = Integer.valueOf(8080);
    }
 else{