Skip to content

Instantly share code, notes, and snippets.

@roberthamel
roberthamel / eslintrc.json
Created September 6, 2017 19:30
React Native eslint config
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
@roberthamel
roberthamel / freecodecampe-randomquotemachine.markdown
Created September 30, 2017 19:52
freecodecampe-RandomQuoteMachine
@roberthamel
roberthamel / generate-pushid.js
Created January 8, 2018 03:53 — forked from mikelehen/generate-pushid.js
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@roberthamel
roberthamel / .bashrc
Last active February 3, 2018 15:44
Some Windows config
##########
# WSL
##########
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# if running in terminal
if test -t 1; then
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@roberthamel
roberthamel / Menu.java
Created February 14, 2018 03:21 — forked from Superpat/Menu.java
A small java command line api to generate a menu that can return a generic
import java.util.List;
import java.util.Optional;
import java.util.Scanner;
/** Menu api for the command line
* <p>
* Takes a list of options containing a value and a menu title, when called, the menu returns an optional type containing the option.
* </p>
* @author Patrick Marchand <[email protected]>
* @version 0.2
@roberthamel
roberthamel / commands.sh
Last active March 14, 2018 00:40
install jenkins on ec2
# install java 8, uninstall java 7
sudo yum install java-1.8.0
sudo yum remove java-1.7.0-openjdk
# make java 8 default
sudo /usr/sbin/alternatives --config java
sudo /usr/sbin/alternatives --config javac
# install maven
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

Mockito - Part 2

01: Creating a Hello World Controller

// [...]/controllers/HelloWorldController.java

@RestController
public class HelloWorldController {
 
@roberthamel
roberthamel / QnA.md
Last active July 3, 2018 11:59
Questions and Answers

./gradlew build -x test --continuous ./gradlew bootRun