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
const fibonacci = (num: number): number => {
if (num === 1 || num === 2) {
return 1;
}
return fibonacci(num - 1) + fibonacci(num - 2);
};
export class GeneratorService {
generate(labels: string[], numRange: [number, number], width: number): EmployeeData[] {
const result: EmployeeData[] = [];
for (let i = 0; i < width; i += 1) {
result.push(this.generateNode(labels, numRange));
}
return result;
}
@nicobytes
nicobytes / gist:243760f9a1af798e8d7bf8531a1f6c65
Created April 22, 2019 14:12
Create service for docker-cleanup in docker swarm
docker service create -d \
-e CLEAN_PERIOD=900 \
-e DELAY_TIME=600 \
--log-driver json-file \
--log-opt max-size=1m \
--log-opt max-file=2 \
--name=cleanup \
--mode global \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
meltwater/docker-cleanup
vim ~/.ssh/config
Host name
HostName xxxx
Port 22
User root
IdentityFile ~/.ssh/your_key
ssh name
node_modules/.bin/knex migrate:make migrate_name
node_modules/.bin/knex seed:make seed_name
@nicobytes
nicobytes / app.component.ts
Last active February 15, 2018 18:45
app.component.ts
import { PageTopTransition } from './core/transitions/page-top.trasnsition';
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@Component({
templateUrl: 'app.html'
})
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
@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) => {
@nicobytes
nicobytes / deploy-gh.sh
Last active August 3, 2020 20:14
Deploy gh-pages ionic pwa
#!/bin/bash
git branch -D gh-pages
git push origin --delete gh-pages
git checkout -b gh-pages
ionic build --prod
find . -type d ! -path './www*' ! -path './.git*' ! -path '.' | xargs rm -rf
rm -r *.*
mv www/* .
rm -rf www
git add .
@nicobytes
nicobytes / pipelines.yml
Created October 6, 2017 04:04
Install chrome for CI
image: node:6.9.4
pipelines:
branches:
master:
- step:
script:
- apt-get update; apt-get install -y gettext-base;
- echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- set -x && apt-get update && apt-get install -y xvfb google-chrome-stable