Skip to content

Instantly share code, notes, and snippets.

View jocafi's full-sized avatar

Jocca jocafi

  • IT Freelancer
  • Brazil / Germany
View GitHub Profile
@jocafi
jocafi / angular-nativescript-course-setup.sh
Created May 11, 2018 19:38 — forked from berardo/angular-nativescript-course-setup.sh
Script to install all good tools on a fresh new macOS machine. Some command are commented out because the main reason for this file is to be used on my online course: https://udemy.com/angular-native
#!/bin/sh
# Allow locate commands
# sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
# xcode command line - Select: "Get xcode" and go get a coffee (preferably far from your desk :)
xcode-select --install
# home-brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@jocafi
jocafi / angular-nativescript-course-setup-ubuntu1.sh
Created May 11, 2018 19:39 — forked from berardo/angular-nativescript-course-setup-ubuntu1.sh
1st script to install all good tools on a fresh new Linux machine. The main reason for this file is to be used on my online course: https://udemy.com/angular-native. After that you might want to continue installing this: https://gist.github.com/berardo/165d6047948125dba7cbcd2eaefcfe6e
#!/bin/sh
# sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 libstdc++6:i386
sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 libstdc++6:i386
# G++
sudo apt-get install g++
# zsh
sudo apt-get install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
@jocafi
jocafi / angular-nativescript-course-setup-ubuntu2.sh
Created May 11, 2018 19:39 — forked from berardo/angular-nativescript-course-setup-ubuntu2.sh
2nd script to install all good tools on a fresh new Linux machine. The main reason for this file is to be used on my online course: https://udemy.com/angular-native. Be sure you have everything in the 1st script: https://gist.github.com/berardo/80aa074fa870990744bb1ef8829cc0cf
# Java
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install java-common oracle-java8-installer
# sudo update-alternatives --config java
sudo apt-get install oracle-java8-set-default
echo "export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')" >> ~/.zshrc
source ~/.zshrc
@jocafi
jocafi / angular-nativescript-course-setup-windows10.bat
Created May 11, 2018 19:39 — forked from berardo/angular-nativescript-course-setup-windows10.bat
Script to install all good tools on a fresh new Windows 10 machine. The main reason for this file is to be used on my online course: https://udemy.com/angular-native Raw
:: I think it's didactic showing the actions done here in the window
:: @echo off
:: This line should be executed before you run the current script
:: Don't follow along before doing that
:: @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
:: Git
choco install git.install -y
:: Restart your command prompt
@jocafi
jocafi / enum-helper.ts
Last active February 10, 2020 20:41
Enumeration Helpers in TypeScript
/**
* Created by Joao Araujo (jocafi) on August 2018
*
* All enum structures in TypeScript are converted to an JS object that contains keys / values.
* Example:
*
* enum Color {
* Red,
* Green,
* Blue,
@jocafi
jocafi / util.service.ts
Last active January 7, 2019 10:13
DeepCopy in TypeScript
import { Injectable } from "@angular/core";
/**
* Created by Joao Araujo (jocafi) on November 2018
*
* UtilService implements some util methods which can be used along the App development.
*
*/
@Injectable()
export class UtilService {
@jocafi
jocafi / type-helper.ts
Created November 13, 2018 19:59
The class TypeHelper was implemented to overcome some weakness of enum structures in TypeScript.
/**
* Created by Joao Araujo (jocafi) on November 2018
*
* The class TypeHelper was implemented to overcome some weakness of enum structures in TypeScript.
*
* <h2>How to use it?</h2>
*
* 1) Declare all the keys like the example below:
*
* public static STATUS_ID = "STATUS_ID";
@jocafi
jocafi / Dockerfile
Last active December 6, 2018 09:34
Deployment using Docker for static web apps or SPA (Tests purposes only)
# To CREATE, run:
# $ docker build -f Dockerfile -t jocafi/myapp:1.0.0 .
# To START, run:
# $ docker run -p 3000:3000 --name myapp -d jocafi/myapp:1.0.0
FROM node:10.13.0-alpine
WORKDIR $HOME/dist
# dist contains the Angular App or any SPA
@jocafi
jocafi / MyDatetime.java
Last active July 10, 2019 15:50
Date/Time Java <=> JavaScript
// It works only using Java SDK 8+
class MyDatetime {
/**
* Convert a date as string generated by JavaScript using the command JSON.stringify()
* to a Java Date.
*
* @param sDate date to be converted. Ex: 2018-11-29T14:03:27.281Z
* @return Java Date
*/
@jocafi
jocafi / index.html
Created January 18, 2019 14:22
Bootstrap Starter Template
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">