Skip to content

Instantly share code, notes, and snippets.

View itsmanishagarwal's full-sized avatar

Manish Agarwal itsmanishagarwal

  • Amazon
  • San Jose, CA, USA
View GitHub Profile
@itsmanishagarwal
itsmanishagarwal / 0_reuse_code.js
Created August 15, 2016 08:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@itsmanishagarwal
itsmanishagarwal / pom.xml
Created April 6, 2016 07:11
Example including the .ebextensions directory
<artifactId>maven-war-plugin</artifactId>
<configuration>
<packagingIncludes>*/**,.ebextensions/**</packagingIncludes>
@itsmanishagarwal
itsmanishagarwal / gist:ff8ba3d4c018e82bb25b
Created February 27, 2015 02:05
Blog: No form parameters are passed when submitting a form
<form accept-charset="UTF-8" role="form" class="form-signin" action="loginProcess" method="post">
<fieldset>
<input class="form-control" placeholder="Username" id="username"
type="text">
<input class="form-control"
placeholder="Password" id="password" type="password">
<input class="btn btn-lg btn-success btn-block" type="submit"
id="login" value="Login ª">
</fieldset>
</form>
@itsmanishagarwal
itsmanishagarwal / Spring-Tiles
Last active August 29, 2015 14:07
Spring-Tiles config
<bean class="org.springframework.web.servlet.view.tiles3.TilesViewResolver"/>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<value>/WEB-INF/tiles-def.xml</value>
</property>
</bean>
<?xml version="1.0" encoding="UTF-8"?>
<groups xmlns="http://www.isdc.ro/wro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">
<group name="all">
<js>/js/app.js</js>
<js>/js/app1.js</js>
<css>/css/main.css</css>
<css>/css/main1.css</css>
<filter>
<filter-name>WebResourceOptimizer</filter-name>
<filter-class>ro.isdc.wro.http.WroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>WebResourceOptimizer</filter-name>
<url-pattern>/resources/*</url-pattern>
</filter-mapping>
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-core</artifactId>
<version>1.5.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-extensions</artifactId>
@itsmanishagarwal
itsmanishagarwal / gist:7da775123a0ba64238b4
Created August 8, 2014 04:07
Corrected Spring method
@RequestMapping(value = "/enter", method = RequestMethod.POST)
public String enter(HttpServletRequest request, ModelMap map, HttpSession session,
@ModelAttribute @Valid User user, BindingResult result) {
if (result.hasErrors()) {
logger.debug("validation error");
map.addAttribute("error", result.getFieldError().getDefaultMessage());
return "enter.again";
}
try {
userService.create(user);
@RequestMapping(value = "/enter", method = RequestMethod.POST)
public String enter(@ModelAttribute @Valid User user, HttpServletRequest request, ModelMap map, HttpSession session,
BindingResult result) {
if (result.hasErrors()) {
logger.debug("validation error");
map.addAttribute("error", result.getFieldError().getDefaultMessage());
return "enter.again";
}
try {
userService.create(user);