Skip to content

Instantly share code, notes, and snippets.

View ferrao's full-sized avatar
🎯
Focusing

Rui Ferrão ferrao

🎯
Focusing
View GitHub Profile
@ferrao
ferrao / highlight.js
Created October 4, 2018 15:24
React DraftJS WYSIWYG prism syntax highlight
const convertContent = content => {
const blockMap = content.getBlockMap();
let newBlockMap = Map();
blockMap.valueSeq().forEach(block => {
if (block.getType() === 'code') {
const data = block.getData().merge({ language: 'javascript' });
const newBlock = block.merge({ type: 'code-block', data });
newBlockMap = newBlockMap.set(block.key, newBlock);
}
@ferrao
ferrao / aws-beenstalk.md
Last active September 27, 2019 07:59
AWS beenstalk

AWS BeenStalk and Node.JS

Create new ebs application

eb init

Rename EBS environment name

eb config save my-env-name --cfg my-config-name # save the environment config
eb terminate # terminate the environment
eb create my-new-env-name --cfg my-config-name # Create a new cloned environment with a new name
@ferrao
ferrao / EntityManagerHelper.java
Last active October 9, 2017 21:27
JPA EntityManager util class using thread local to assure thread-safety
public class EntityManagerHelper {
private static final EntityManagerFactory emf;
private static final ThreadLocal<EntityManager> threadLocal;
static {
emf = Persistence.createEntityManagerFactory("BookStoreUnit");
threadLocal = new ThreadLocal<EntityManager>();
}
@ferrao
ferrao / agnoster-mod.js
Last active July 12, 2017 08:39
oh-my-zsh agnoster theme modification for multiline support
PROMPT='%{%f%b%k%}$(build_prompt)%{$reset_color%}
➜ '