Skip to content

Instantly share code, notes, and snippets.

View lovejavaee's full-sized avatar
👋
Java | C++ | Python | ML | DL

Jeff M lovejavaee

👋
Java | C++ | Python | ML | DL
View GitHub Profile
@lovejavaee
lovejavaee / gist:9f819b1277e215e705fd
Created November 5, 2015 16:39
CQ5 curl commands
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
@lovejavaee
lovejavaee / complete.vim
Created January 10, 2016 02:43 — forked from chemzqm/complete.vim
My supertab, complex plugin completion is quite confusing
" Take <tab> for word complete only
" The 'complete' option controls where the keywords are searched (include files, tag files, buffers, and more).
" The 'completeopt' option controls how the completion occurs (for example, whether a menu is shown).
if exists('did_completes_me_loaded') || v:version < 700
finish
endif
let did_completes_me_loaded = 1
function! s:completes_me(shift_tab)
@lovejavaee
lovejavaee / custom-submit.js
Created March 2, 2016 06:25
[AngularJS] Custom submit handler that will only submit when all validation is passed
/**
* Custom submit directive that will only submit when all the validation has passed
* for all the fields. This extends on the ng-submit directive provided by AngularJS.
*
* This directive will also remove the 'pristine' flag from all the fields when
* hitting submit, allowing the form to display no errors until the submit button
* is clicked/enter is pressed.
*
* The variable 'app' is the instance of a module.
* E.g. var app = angular.module('my-app', []);
@lovejavaee
lovejavaee / gist:06872cd7e18239805f3a
Created March 5, 2016 09:59 — forked from ritou/gist:3149557
OpenID Connect Session Management Demo
@lovejavaee
lovejavaee / tmux-cheatsheet.markdown
Created April 24, 2016 02:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
Github
A big project work. If you wanna build website, develop mobile or web application or do your assignment with your teammates of course use github.
Gist
more like a memo. for example you can write the implementation of a small feature and share it to your blog or write down what you think about the project and share it with your teammates. Just like what the above answers said, gist is used for more like code snippet thing. So normally if you work on a project you use github.
@lovejavaee
lovejavaee / install-docker-compose.sh
Created May 10, 2017 04:01 — forked from daspecster/install-docker-compose.sh
Centos 7 docker compose install from scratch
#!/bin/bash
sudo yum update -y
sudo yum install -y netstat git rubygems gcc kernel-devel make perl
sudo yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel maven
sudo gem install sass
cd /tmp
#!/usr/bin/env python
from __future__ import print_function
import ansible.executor.task_queue_manager
import ansible.inventory
import ansible.parsing.dataloader
import ansible.playbook.play
import ansible.plugins.callback
import ansible.vars
@lovejavaee
lovejavaee / CustomResponseEntityExceptionHandler.java
Created July 24, 2017 09:03 — forked from matsev/CustomResponseEntityExceptionHandler.java
Generic response error handling using @ControllerAdvice
@ControllerAdvice
public class CustomResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatus status, WebRequest request) {
List<FieldError> fieldErrors = ex.getBindingResult().getFieldErrors();
List<ObjectError> globalErrors = ex.getBindingResult().getGlobalErrors();
List<String> errors = new ArrayList<>(fieldErrors.size() + globalErrors.size());
String error;
for (FieldError fieldError : fieldErrors) {
There is no doubt about the need for automated tests.
They
assure refactoring steps
help to detect weaknesses in the implementation
document the implemented logic
enable the implementation of modules, even if some basic modules are still missing (mocking)
Basically tests consist of 3 steps: Arrange, Act and Assert. That means establishing the test environment (Arrange), executing the logic (Act) and verifying the expectation (Assert).
Consider a bank account with the possibility to deposit money as a simple example. The implementation in advance: