Skip to content

Instantly share code, notes, and snippets.

View ansidev's full-sized avatar
🎯
Focusing

Le Minh Tri ansidev

🎯
Focusing
View GitHub Profile
@ansidev
ansidev / AppController.php
Created November 7, 2014 04:47
Login CakePHP 2.5.5
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ansidev
ansidev / EmptyValidator.java
Created May 22, 2016 16:59
Vaadin Empty Validator
package xyz.ansidev.vaadin.validator;
import com.vaadin.data.validator.AbstractStringValidator;
@SuppressWarnings("serial")
public class EmptyValidator extends AbstractStringValidator {
public EmptyValidator(String errorMessage) {
super(errorMessage);
}
if (string) {
// do something if string is "true"
}
else {
// do something if string is "false"
}
if (Boolean(string)) {
// do something if string is "true"
}
else {
// do something if string is "false"
}
if (string == "true") {
// do something if string is "true"
}
else {
// do something if string is "false"
}
string = (string == "true");
@ansidev
ansidev / MouseWheelTabScroll4Chrome.ahk
Created December 4, 2016 14:56
Mouse Wheel Tab Scroll For Chrome
; Mouse Wheel Tab Scroll 4 Chrome
; -------------------------------
; Scroll though Chrome tabs with your mouse wheel when hovering over the tab bar.
; If the Chrome window is inactive when starting to scroll, it will be activated.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance force ; Determines whether a script is allowed to run again when it is already running.
#UseHook Off ; Using the keyboard hook is usually preferred for hotkeys - but here we only need the mouse hook.
#InstallMouseHook
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;
*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and Task = 13312 and (band(Keywords,9007199254740992)) and (EventID=4688)]]
and
*[EventData[Data[@Name='NewProcessName'] and (Data='Path to chrome.exe')]]
package studio.safe.spring.resttemplate;
import java.io.File;
import java.io.IOException;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
// JQuery tips for select
var selectElement = $('#select-id');
// Clear all select options
selectElement.empty();
// Append options to select
selectElement.append($('<option>', {
value: 'value',
text: 'text'