Skip to content

Instantly share code, notes, and snippets.

@Adria87
Adria87 / flexbox-cheatsheet.md
Created December 18, 2018 11:16
[Flexbox cheatsheet] #flex
@Adria87
Adria87 / Java conventions.md
Created December 17, 2018 14:49
[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.
@Adria87
Adria87 / Java cheatsheet.md
Created December 17, 2018 14:48
[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)
@Adria87
Adria87 / directives.md
Created December 17, 2018 14:47
[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).
@Adria87
Adria87 / controllers.md
Created December 17, 2018 14:46
[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).
@Adria87
Adria87 / services.md
Created December 17, 2018 14:46
[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);
@Adria87
Adria87 / csscheatsheet.md
Created December 17, 2018 14:45
[CSS cheatsheet] #css

/* RGBA Color Specification */

background-color: rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.3);

/* Box Shadow Attributes // (Inset or No, Horiz. (px), Vert. (px), Blur Radius, Spread, Shadow Color) */

/* Box Shadow - Standard */ box-shadow: 0px 0px 5px 1px #444;

@Adria87
Adria87 / css-selector.md
Created December 17, 2018 14:44
[CSS selector] #css

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@Adria87
Adria87 / sass-cheatsheet.md
Created December 17, 2018 14:44
[SASS cheatsheet] #css #sass

//Single line comments are removed when Sass is compiled to CSS.

/* Multi line comments are preserved. */

/* Variables ============================== */