Skip to content

Instantly share code, notes, and snippets.

View dferrandizmont's full-sized avatar
🏠
Working from home

Daniel Mont Ferrandiz dferrandizmont

🏠
Working from home
  • Terrassa, Barcelona.
  • 23:26 (UTC +02:00)
View GitHub Profile
@dferrandizmont
dferrandizmont / Java conventions.md
Last active August 2, 2022 06:54
[Java conventions] #java

Coding Conventions

This file will cover important coding practices that are important to stress when coding this program. Listed below are some of the more important details that should be stressed. Each programmer has his/her own way to deliver code. The importance of having similar coding conventions throughout this program are listed below.

  • 80% of the time spent on a piece of software goes to maintenance.
  • Hardly any software is maintained for its whole life by the original author.
  • Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.
  • If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.
@dferrandizmont
dferrandizmont / Java cheatsheet.md
Last active December 17, 2018 15:24
[Java cheatsheet] #java
Operation Code
New List List<Integer> x = new ArrayList<Integer>();
Copy List List<Integer> x = new ArrayList<Integer>(y);
Add an element to the List x.add(element)
Get an elemenet from the List x.get(index)
Clear the list x.clear()
New HashMap HashMap<Integer, String> x = new HashMap<Integer, String>();
Add element to the map x.put(key, value)
Get an element from the map x.get(key)
@dferrandizmont
dferrandizmont / composition.md
Last active December 17, 2018 14:39
[Composition] #angular

Composition

It is important not to hide composition. It should be done centrally, at the root of the application.

In angular there are 2 different resources we must compose in order to build an application

  • Using a composition root we map directives, controllers, and services into the injector.

  • Using routing we compose views from HTML partials and controllers for each different application state.

@dferrandizmont
dferrandizmont / directives.md
Created December 16, 2018 10:37
[Directives] #angular

Directives

Use a directive to augment a DOM node:

  • To transform its contents in a regular manner.
  • To add a behaviour that is general and reusable.

Do not use a directive:

  • To augment or manipulate shared scope (use a controller instead).
  • To allow a partial to include another partial specific to your application (this is not composable, use nested states instead).
@dferrandizmont
dferrandizmont / controllers.md
Created December 16, 2018 10:37
[Controllers] #angular

Controllers

Use a controller to augment shared scope.

  • To decorate it with value that HTML partials may bind to.
  • To provide behaviour that HTML partials may invoke.

Do not use a controller:

  • To store application state (describe in the route instead).
  • To store persistent data (controllers and scope are dropped on every route change, use service instead).
  • To implement behaviour and business logic (defer to a service).
@dferrandizmont
dferrandizmont / services.md
Last active December 17, 2018 14:39
[Services] #angular

Services

Use service for any Class that is to be mapped into the dependency injector.

Do not use a service for a method (use a Class instead).

Services are implemented as a Class and should be PascalCase. Angular will instantiate once only and inject the same instance in all cases. The dependency is therefore camelCase since it is an instance and should not be new'd. For example:

angular.module(...).service('myService', MyService);
@dferrandizmont
dferrandizmont / ionic3cheatsheet.md
Created December 16, 2018 10:38
[Ionic 3 cheatsheet] #ionic

Ionic 3 cheat sheet by Benjamin

Les commandes principales:

  • npm install -g cordova ionic #Installer Ionic
  • $ ionic info #Récupérer toutes les info
  • $ ionic start blank #Créer un projet vierge
  • $ ionic start "myApp" #Multiple choix de création de projet
  • $ ionic generate #Creation divers
  • $ ionic generate component
@dferrandizmont
dferrandizmont / bashcheatsheet.md
Created December 16, 2018 10:39
[Bash cheatsheet] #bash

man COMMAND # Look up help for the given command

pwd # Print working directory cd MYDIR # Change directory to MYDIR cd ~/ # Change directory to user root (/Users/USERNAME) cd .. # Change directory up a level mkdir NEWDIR # Create a new directory in the current folder called NEWDIR

cp FROM_FILE TO_FOLDER # Copy FROM_FILE into TO_FOLDER cp -r FROM_DIR TO_FOLDER # Copy FROM_DIR into TO_FOLDER

@dferrandizmont
dferrandizmont / firebasedatabase.md
Created December 16, 2018 10:40
[Firebase database api] #firebase
There is no way to store an empty object/array/null value.
There are also no actual arrays.  Array values get stored as objects with integer keys.
    (If all keys are integers, it will be returned as an array.)

Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.

── Classes ──

DataSnapshot : Container for a subtree of data at a particular location.

@dferrandizmont
dferrandizmont / firebase.md
Created December 16, 2018 10:41
[Firebase] #firebase
title prism_languages tags layout
Firebase
coffeescript
WIP
2017/sheet

Authenticating