Skip to content

Instantly share code, notes, and snippets.

View fuchodeveloper's full-sized avatar
🏠
Working from home

Fredrick Mgbeoma fuchodeveloper

🏠
Working from home
View GitHub Profile
# Insert your preferred key mappings here.
map j scrollUp
map k scrollDown
map d scrollPageUp
map s scrollPageDown
unmap x
// null value
null || 20 // returns 20
null ?? 20 // returns 20
// undefined value
undefined || 20 // returns 20
undefined ?? 20 // returns 20
// boolean
true ?? 10 // returns trueb
@fuchodeveloper
fuchodeveloper / hello.html
Created April 23, 2018 21:49
Form to enter user details
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Say hello in Spring</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Enter first and last names</h1>
<form action="#" th:action="@{/hello}" th:object="${hello}" method="post">
<p>First: <input type="text" th:field="*{firstName}" /></p>
@fuchodeveloper
fuchodeveloper / result.html
Created April 23, 2018 21:46
Display custom hello message
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Hello Result</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Howdy!</h1>
<p th:text="'Hello, ' + ${hello.firstName} + ' ' + ${hello.lastName}" />
<a href="/hello">New user?</a>
@fuchodeveloper
fuchodeveloper / Application.java
Created April 23, 2018 21:39
Main application entry file
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication .run(Application.class, args);
}
@fuchodeveloper
fuchodeveloper / Hello.java
Created April 22, 2018 15:59
Hello model class
package hello;
public class Hello {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
@fuchodeveloper
fuchodeveloper / HelloController.java
Last active April 23, 2018 21:41
Form controller file
package hello;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
@Controller
public class HelloController {
@fuchodeveloper
fuchodeveloper / pom.xml
Created April 22, 2018 01:50
XML configuration for Spring project
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>spring-hello</artifactId>
<version>1.0-SNAPSHOT</version>