Skip to content

Instantly share code, notes, and snippets.

View billyyarosh's full-sized avatar

Billy Yarosh billyyarosh

View GitHub Profile
plugins {
compile ':spring-security-core:1.2.7.3'
compile ':mongodb:1.0.0.GA'
compile ':webxml:1.4.1'
compile ':ws-client:1.0'
runtime ':resources:1.1.6'
runtime ':jquery:1.8.0'
runtime ':lesscss-resources:1.3.0.3'
build ':tomcat:2.2.0'
@billyyarosh
billyyarosh / ApplicationResource.groovy
Created January 7, 2013 18:12
A better example of how to add resources in Grails 2.x
modules = {
application {
resource url:'js/application.js'
}
bootstrap {
resource url:'less/custom-bootstrap.less',attrs:[rel: "stylesheet/less", type:'css']
dependsOn 'jquery'
dependsOn 'bootstrapJs'
}
@billyyarosh
billyyarosh / gist:2878800
Created June 5, 2012 23:31
Animal Class sort Output
GROUP Animals by same class type
----------------------------------------------
Animal: {
Class: BIRD
Species: Crow
Vertebrate: true
Color: java.awt.Color[r=0,g=0,b=0]
};
Animal: {
Class: BIRD
@billyyarosh
billyyarosh / AnimalListStrategy.java
Created June 5, 2012 18:59
Example of using concrete strategies.
package com.keaplogik.examples.design.patterns.strategy;
import com.keaplogik.examples.model.animals.Animal;
import java.util.Comparator;
/**
* Holds concrete strategies for working with animal lists.
* @keaplogik
*/
public enum AnimalListStrategy {
@billyyarosh
billyyarosh / RunAnimalStrategyDemo.java
Created June 5, 2012 18:54
Simple sort strategy on an object of animals. Group by animal class type.
/**
*
* Run a demo for supplying different strategies to sort a list
* of animals.
*
* @author keaplogik
*/
public class RunAnimalStrategyDemo {
public static void main(String[] args) {
@billyyarosh
billyyarosh / Animal.java
Created June 5, 2012 18:50
Animal interface and a simple implemntation
package com.keaplogik.examples.model.animals;
import java.awt.Color;
public interface Animal {
public enum AnimalClass {
MAMMAL,
BIRD,
FISH,
@billyyarosh
billyyarosh / Comparator.java
Created June 5, 2012 15:10
java.util.Comparator
package java.util;
public interface Comparator<T> {
public int compare(T t, T t1);
}
@billyyarosh
billyyarosh / web_atmo_spring.xml
Created May 15, 2012 21:41
Configuration of Meteor servlet in web.xml
<servlet>
<servlet-name>feeds</servlet-name>
<servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
<init-param>
<param-name>org.atmosphere.servlet</param-name>
<param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.broadcasterClass</param-name>
<param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value>
@billyyarosh
billyyarosh / connector_server_atmo.xml
Created May 15, 2012 21:11
connector for atmosphere on tomcat
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="600000"
redirectPort="8443" />
@billyyarosh
billyyarosh / concurrentControllerMethod.java
Last active October 4, 2015 21:48
controller gist for atmosphere concurrency
@RequestMapping(value="/twitter/concurrency")
@ResponseBody
public void twitterAsync(AtmosphereResource atmosphereResource){
final ObjectMapper mapper = new ObjectMapper();
this.suspend(atmosphereResource);
final Broadcaster bc = atmosphereResource.getBroadcaster();
logger.info("Atmo Resource Size: " + bc.getAtmosphereResources().size());