Skip to content

Instantly share code, notes, and snippets.

View josephmtinangi's full-sized avatar

Joseph Mtinangi josephmtinangi

View GitHub Profile
JDBC_DATABASE_URL=jdbc:postgresql://localhost:5432/database_name
JDBC_DATABASE_USERNAME=postgres
JDBC_DATABASE_PASSWORD=postgres
heroku plugins:install heroku-cli-deploy
mvn clean package
heroku deploy:jar target/heroku-demo-0.0.1-SNAPSHOT.jar --app <APP-NAME>
heroku logs --tail --app <APP-NAME>
public class App {
public static void main(String[] args) {
String string1 = "string1";
String string2 = "string2";
String checksum = DigestUtils
.sha1Hex(String.valueOf((string1.length() + DigestUtils.md5Hex(string2).length())));
System.out.println("string1 = " + string1);
@josephmtinangi
josephmtinangi / Helper.java
Created March 4, 2018 13:54
Java Create Response Helper Utility Function
public class Helper {
public static ResponseEntity<?> createResponse(boolean success, Object data, String message, HttpStatus code) {
HashMap<String, Object> response = new HashMap<>();
response.put("success", success);
response.put("data", data);
response.put("message", message);
response.put("code", code);
@josephmtinangi
josephmtinangi / application.properties
Created March 4, 2018 13:43
Spring Boot Application Properties
spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.username=${JDBC_DATABASE_USERNAME}
spring.datasource.password=${JDBC_DATABASE_PASSWORD}
spring.jpa.show-sql=false
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create
@josephmtinangi
josephmtinangi / ClientInfo.java
Created February 2, 2018 17:55 — forked from c0rp-aubakirov/ClientInfo.java
How to get full client info using servlet request, including client IP, browser, os, use-agent and referer
public void printClientInfo(HttpServletRequest request) {
final String referer = getReferer(request);
final String fullURL = getFullURL(request);
final String clientIpAddr = getClientIpAddr(request);
final String clientOS = getClientOS(request);
final String clientBrowser = getClientBrowser(request);
final String userAgent = getUserAgent(request);
logger.info("\n" +
php artisan cache:clear
php artisan view:clear
php artisan config:cache
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Top Github Users</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/cosmo/bootstrap.min.css">
<style id="jsbin-css">
.loading {
$.ajax({
url: '',
data: {
format: 'json'
},
error: function() {
console.log('error');
},
dataType: 'json',
success: function(data) {