This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateInspector { | |
public static boolean isLastWorkingDayOfMoth(Calendar date) { | |
// get the current date | |
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); | |
// get the calendar last day of this month | |
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH); | |
// set the current date to the last day of the month | |
cal.set(Calendar.DAY_OF_MONTH, lastDay); | |
// if it's on a weekend, transform it accordingly | |
switch (cal.get(Calendar.DAY_OF_WEEK)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
$jdk5 = <<script | |
wget -nc "https://www.dropbox.com/s/rvhj797qe9uvetv/jdk-1_5_0_22-linux-amd64.bin?dl=0" \ | |
-O jdk-1_5_0_22-linux-amd64.bin | |
chmod +x jdk-1_5_0_22-linux-amd64.bin | |
yes | sh jdk-1_5_0_22-linux-amd64.bin | |
script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
declare -r MULTI_PJ_HOME='<THE_MULTI_PROJECT_ROOT_PATH>' | |
declare -r projects="<LIST_OF_MODULES_IN_RESPECT_OF_THE_MULTI_PROJECT_ROOT_PATH>" | |
for project in $projects | |
do | |
echo "================================================" | |
echo "Updating $project" | |
echo "================================================" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PropertiesUtis { | |
public static void copyProperties(Object fromObj, Object toObj) { | |
Class<? extends Object> fromClass = fromObj.getClass(); | |
Class<? extends Object> toClass = toObj.getClass(); | |
try { | |
BeanInfo fromBean = Introspector.getBeanInfo(fromClass); | |
BeanInfo toBean = Introspector.getBeanInfo(toClass); | |
PropertyDescriptor[] toPd = toBean.getPropertyDescriptors(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Weblogic ClassLoader on CDI Extension don´t localize META-INF/services necessary to load ProcessEngine. | |
* <p> | |
* This class provides an overriding extension point which uses the correct classloader, in order to instantiate | |
* a {@link org.activiti.cdi.spi.ProcessEngineLookup} | |
* </p> | |
*/ | |
public class WeblogicActivitiExtension extends ActivitiExtension { | |
public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Range { | |
static ID:string = 'range'; | |
static filter() { | |
return (num:number, offset:number = 1) => { | |
var res = []; | |
for (var i = offset; i <= num; i = i + offset) { | |
res.push(i); | |
} | |
return res; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LodashStatic = _; | |
class NotIn { | |
static ID:string = 'notIn'; | |
static filter() { | |
return (input:any[], blacklist:any[]) => { | |
return LodashStatic.difference(input, blacklist); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.web.context.request.async.DeferredResult; | |
import rx.Observable; | |
import rx.Observer; | |
import rx.Subscription; | |
/** | |
* A {@link DeferredResult} that subscribes to an observable | |
* | |
* @see DeferredResult | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final getIt = GetIt.instance; | |
void configure() { | |
getIt | |
..registerSingleton(Repository()) | |
..registerFactory( | |
() => Bloc(getIt<Repository>())); | |
} |