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
| import {Http, RequestOptionsArgs, Response, RequestOptions, ConnectionBackend, Headers} from '@angular/http'; | |
| import 'rxjs/add/operator/map'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import { Storage } from '@ionic/storage'; | |
| export class HttpProvider extends Http { | |
| constructor (connectionBackend: ConnectionBackend, requestOptions: RequestOptions, public storage: Storage ) { | |
| super(connectionBackend, requestOptions); | |
| } |
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
| const module = angular.mock.module; | |
| const inject = angular.mock.inject; | |
| let searchService; | |
| describe('Testing some awesome service', () => { | |
| beforeAll(module('yourModule')); | |
| beforeEach(inject($injector => { | |
| searchService = $injector.get('SearchClass'); | |
| })); |
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
| console.info($._data($(document)[0], 'events')); | |
| // Example output | |
| // { | |
| // "mousedown": [ | |
| // { | |
| // "type": "mousedown", | |
| // "origType": "mousedown", | |
| // "guid": 1, | |
| // "namespace": "" |
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
| Just for name purpose |
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
| Just for naming purpose |
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
| function writeDOM(e) { | |
| // Imagine some slow/hard function | |
| $("#result").text(`${e.clientX} - ${e.clientY}`); | |
| } | |
| const $checkBox = $('#checkbox'); | |
| const debouncedWriteDom = _.debounce(writeDOM, 100); | |
| $("#container-result").mousemove(e => { | |
| if ($checkBox.is(':checked')) { |
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
| // find elements | |
| let i = 0; | |
| function writeDOM() { | |
| // Imagine some slow/hard function | |
| $("#result").html(i++); | |
| } | |
| const $checkBox = $('#checkbox'); | |
| const throttleWriteDom = _.throttle(writeDOM, 1000); |
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 users = [ | |
| { firstName: "Ldmarz", lastName: "martinez", age: 28, gender: "male" }, | |
| { firstName: "Suli", lastName: "bern", age: 5, gender: "female" }, | |
| { firstName: "Marianis", lastName: "Carrey", age: 54, gender: "male" }, | |
| { firstName: "Jhon", lastName: "carret", age: 40, gender: "female" } | |
| ]; | |
| var user = _.find(users, { name: "ldmarz", gender: "male" }); | |
| // { firstName: "Ldmarz", lastName: "martinez", age: 28, gender: "male" }, |
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 someNiceObject = { hello: { someDeepKey: "hello" } }; | |
| _.set(someNiceObject, "hello.items[0]", "An item"); | |
| // here items was added safely | |
| // someNiceObject === { hello: { someDeepKey: "hello", items: ["An item"] } } | |
| //Here we can access to a not existing key getting a default value instead | |
| var name = _.get(someNiceObject, "someNotExistingKey", "Ldmarz"); | |
| // name => Ldmarz |
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
| const someArray = [1, 1, 3] | |
| const cleanArray = _.uniq(someArray); | |
| // cleanArray === [1, 3] |
OlderNewer