This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- 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; | |
| "> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Basics | |
| ... | |
| ### Class/style bindings | |
| Always use a **computed property** when possible: | |
| ```javascript | |
| <div v-bind:class="classObject"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| With tmutil, I’m able to programmatically set Time Machine exclusions, a la: | |
| ``` | |
| tmutil addexclusion /path/to/my/fileOrDirectory | |
| ``` | |
| ### Asimov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| }, []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 | |
| //... | |
| } |
NewerOlder