Skip to content

Instantly share code, notes, and snippets.

View zEvg's full-sized avatar

Evgeniy Zakharchenko zEvg

  • Kyiv, Ukraine
View GitHub Profile
package com.velti.bb.platform.security;
import org.springframework.security.web.util.RequestMatcher;
import javax.servlet.http.HttpServletRequest;
/**
* This request matcher is used in jungle of Spring Security
* in order to decide what requests should be cached in case of user
* is visiting some page while he's not authenticated.
@zEvg
zEvg / context.xml
Created February 1, 2013 10:43
Spring Injection in JSR-303's Custom Validators
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitName" value="spring-jpa"/>
<property name="jpaPropertyMap">
<map>
<entry key="javax.persistence.validation.factory" value-ref="validator" />
</map>
</property>
<property name="jpaProperties">
<props>
@zEvg
zEvg / countries.sql
Created January 25, 2013 20:50
Countries list
INSERT INTO country (iso_code,name) VALUES ('BD','Bangladesh, People''s Republic of');
INSERT INTO country (iso_code,name) VALUES ('BE','Belgium, Kingdom of');
INSERT INTO country (iso_code,name) VALUES ('BF','Burkina Faso');
INSERT INTO country (iso_code,name) VALUES ('BG','Bulgaria, People''s Republic of');
INSERT INTO country (iso_code,name) VALUES ('BA','Bosnia and Herzegovina');
INSERT INTO country (iso_code,name) VALUES ('BB','Barbados');
INSERT INTO country (iso_code,name) VALUES ('WF','Wallis and Futuna Islands');
INSERT INTO country (iso_code,name) VALUES ('BM','Bermuda');
INSERT INTO country (iso_code,name) VALUES ('BN','Brunei Darussalam');
INSERT INTO country (iso_code,name) VALUES ('BO','Bolivia, Republic of');
@zEvg
zEvg / BagMain.java
Last active December 10, 2015 21:38
Example of the Bag implementation behavior
package ;
import java.util.Collection;
public class BagMain {
public static void main(String[] args) {
Collection<Integer> bag = new Bag<Integer>();
bag.add(1);
bag.add(5);
@zEvg
zEvg / gist:2469949
Created April 23, 2012 09:55
Table of regexps [MySql]
INSERT INTO `regexp_table` (`id`, `name`, `regexp`)
VALUES
(1,'first','pi|apa'),
(2,'second','^(pi|apa)$'),
(3,'third','^(pi)*$'),
(4,'fourth','^Ba?n');
select * from regexp_table;
@zEvg
zEvg / gist:2216015
Created March 27, 2012 13:46
inRange() hamcrest matcher
package ;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.junit.internal.matchers.TypeSafeMatcher;
public class InRange extends TypeSafeMatcher<Integer> {
private int lowerEdge = 0;
@zEvg
zEvg / gist:1349466
Created November 8, 2011 22:18
FlexUnit ant task example
<target name="execute-flex-monkey-test" depends="initTest">
<echo>${app.url}/PartnerLogin-FlexMonkeyRunner.swf</echo>
<flexunit
url="${app.url}/PartnerLogin-FlexMonkeyRunner.swf"
command="${flex.monkey.launch.app}"
toDir="${flex.monkey.report.dir}"
haltonfailure="false"
localTrusted="false"
verbose="true"
failureproperty="flexunit.failed"/>
@zEvg
zEvg / CollectionEventBatcher.as
Created July 8, 2011 13:09
Utility for batching ArrayCollection's ADD event. For performance optimization
package com.zevg.utilities
{
import flash.utils.Dictionary;
import mx.collections.ListCollectionView;
import mx.core.EventPriority;
import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
public class CollectionEventBatcher
http://www.ted.com/talks/dan_pink_on_motivation.html
http://www.ted.com/talks/pranav_mistry_the_thrilling_potential_of_sixthsense_technology.html
http://www.ted.com/talks/blaise_aguera.html
http://www.ted.com/talks/david_merrill_demos_siftables_the_smart_blocks.html
http://www.ted.com/talks/ken_robinson_says_schools_kill_creativity.html
http://www.ted.com/talks/julian_assange_why_the_world_needs_wikileaks.html
http://www.ted.com/talks/pattie_maes_demos_the_sixth_sense.html
http://www.ted.com/talks/sir_ken_robinson_bring_on_the_revolution.html
http://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action.html
http://www.ted.com/talks/jamie_oliver.html
@zEvg
zEvg / Selenium Grid init.d script for CentOS 5.5
Created February 22, 2011 12:21
inid.d script for CentOS
#!/bin/bash
# /etc/init.d/selenium-grid
# centos-compatible selenium-grid startup script.
# Eugene Zakharchenko <z.evgeniy[at]gmail.com>
### BEGIN INIT INFO
# Provides: selenium-grid
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6