Skip to content

Instantly share code, notes, and snippets.

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

Nicolas Molina Monroy nicobytes

🏠
Working from home
View GitHub Profile
@nicobytes
nicobytes / userservice
Created April 4, 2017 22:39
userService
getAll(){
return {"results":[{"gender":"female","name":{"title":"miss","first":"آنیتا","last":"نكو نظر"},"location":{"street":"4842 شهید رحمانی","city":"قزوین","state":"گلستان","postcode":88633},"email":"آنیتا.نكونظر@example.com","login":{"username":"beautifulmouse467","password":"prayers","salt":"jCIISMlp","md5":"39762c237b92dd7b8e392669103afdcc","sha1":"1fd5de475c3e607247634fb512e079e143481de3","sha256":"d6945d3a277027ce84afca2fce0a78b32d3f518df0c90fb5c478367a2ae63e4d"},"dob":"1957-12-19 17:41:58","registered":"2002-06-12 01:25:09","phone":"021-59610882","cell":"0947-822-5292","id":{"name":"","value":null},"picture":{"large":"https://randomuser.me/api/portraits/women/17.jpg","medium":"https://randomuser.me/api/portraits/med/women/17.jpg","thumbnail":"https://randomuser.me/api/portraits/thumb/women/17.jpg"},"nat":"IR"},{"gender":"male","name":{"title":"mr","first":"brandão","last":"lopes"},"location":{"street":"6004 rua são pedro ","city":"bragança","state":"santa catarina","postcode":77776},"email":"brand
@nicobytes
nicobytes / load.ts
Created April 16, 2017 16:37
Loading customs
let loading = this.loadingCtrl.create({
spinner: 'hide',
content: `
<div class="custom-spinner-container">
<div class="custom-spinner-box"></div>
</div>`,
duration: 5000
});
@nicobytes
nicobytes / test-provider.spec.ts
Last active August 2, 2017 12:51
Test for provider
import { TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
import { YourService } from './your.service';
describe('Provider: YourService', () => {
//Arrange
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
{ provide: YourService, useClass: YourService },
@nicobytes
nicobytes / app.component.ts
Created August 8, 2017 15:07
check platform
export class YourPage {
constructor(
...
private platform: Platform,
) {
if(this.platform.is('cordova')){
this.initPush();
}
}
//component ts
@Component({
selector: 'your-component',
templateUrl: 'your-component.html',
})
export class YourComponent {
@Input() photo: string;
constructor(
@nicobytes
nicobytes / .ts
Created September 11, 2017 18:44
example
getVendedores(){
let vendedores = [];
let sizeVendedores = 0;
return new Promise((resolve, reject)=>{
this.fireDatabase.list('/supervidores/idSupervidor/VendedoresList')
.subscribe(list =>{
sizeVendedores = list.length;
list.forEach(vendedor=>{
let imei = vendedor.imei;
this.fireDatabase.object('/vendedores/'+imei)
private checkSession(){
if(this.auth.isLoggedIn()){
this.navMaster.setRoot('HomePage');
}else{
this.navMaster.setRoot('LoginPage');
}
this.splashScreen.hide();
}
private generateMarkers(latitude:number, longitude: number, limit: number){
let markers: any[] = [];
for(let i =0;i<limit;i++){
markers.push({
title: 'hola ' + i,
position: {
lat: latitude + Math.random() * (1 - (-1)) + (-1),
lng: longitude + Math.random() * (1 - (-1)) + (-1)
}
});
@nicobytes
nicobytes / page.ts
Created November 1, 2017 13:34
watchPosition
import { Geolocation } from '@ionic-native/geolocation';
...
constructor(private geolocation: Geolocation) {}
...
let watch = this.geolocation.watchPosition();
watch.subscribe((data) => {
apt-get update
apt-get install graphviz
pip install pygraphviz
pip install pyparsing==1.5.7
pip install pydot
python manage.py graph_models --pydot -a -g -o {{project}}-dbmodel.png