Skip to content

Instantly share code, notes, and snippets.

View exhtml's full-sized avatar

span.graphics exhtml

View GitHub Profile
var incidentDate = moment(my_date, 'DD/MMM/YYYY HH:mm:ss').format('YYYY-MM-DD HH:mm:ss'); //formato de entrada, formato de salida
// si usamos formato 'MMM' (tres letras para los meses), en castellano pone un punto (MAR.) y hay que quitarlo a mano
moment(my_date).format('DD MMM YYYY, HH:mm').replace('.', '');
// Otros formatos:
// D MMM YYYY h:mm:ss
// MMMM Do YYYY, h:mm:ss a
<!-- card layout -->
<div style="
display: flex;
/* Put a card in the next row when previous cards take all width */
flex-wrap: wrap;
margin-left: -8px;
margin-right: -8px;
">
Vuex is a pattern (Flux) and a library implementation
Parts:
- **state**: source of truth
- **view**: a declarative mapping of the state
- **actions**: the possible ways the state could change in reaction to user inputs from the view.
One-way data flow
# Basics
...
### Class/style bindings
Always use a **computed property** when possible:
```javascript
<div v-bind:class="classObject"></div>
With tmutil, I’m able to programmatically set Time Machine exclusions, a la:
```
tmutil addexclusion /path/to/my/fileOrDirectory
```
### Asimov
An Angular Cli project uses **TSLint** for 'linting', so we can leave the code-quality rules for TSLint to handle, and we can have **Prettier** take care of formatting rules
Add prettier to your project:
`npm install prettier -D`
Create `.prettierrc`: regardless of what editor your team members use, they will all reference the same configuration file:
```json
{
“printWidth”: 120, //default is 80
“singleQuote”: true, //enforce single quotes instead of double
### NOMINATIM API
buscando por city:
https://nominatim.openstreetmap.org/search?city=barbera%20del%20valles&format=json
directamente buscando por: '08210, BARBERA DEL VALLES'
https://nominatim.openstreetmap.org/search?q=08210,BARBERA%20DEL%20VALLES&format=json
```json
[
{
"place_id": 197787653,
// var pickupPlaces = [...] // ARRAY DE OBJETOS QUE VAMOS A EMPLEAR PARA REALIZAR UNA LLAMADA AJAX POR CADA UNO DE ELLOS
var ajaxCalls = [];
// rellenar el array con todas las llamadas que queramos realizar
pickupPlaces.forEach(function(item) {
ajaxCalls.push(
$.ajax({
url: GEOSEARCHAPI_URL + 'search?q=' + item.Descripcion + '&format=json'
pickupPlaces = bookingPlaces.filter(function(item) {
return item.Tipo === 'L' && item.Descripcion;
}).reduce(function(prev, current){
// if the next object's description is not found in the output array
// push the object into the output array
if (!prev.some(function (item) { return item.Descripcion === current.Descripcion; })) {
prev.push(current);
}
return prev;
}, []);
// test.service.ts
//...
import { Subject } from 'rxjs'; // import subject from RxJS
//...
export class TestService {
activatedEmitter = new Subject<boolean>(); // it's pretty similar to EventEmitter: a generic type where you define which data will eventually be emitted
//...
}