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
[Unit] | |
Description=Application NodeJS | |
# Requires the mysql service to run first | |
Requires=After=mysql.service | |
[Service] | |
ExecStart=/usr/bin/node /app/main.js | |
# Required on some systems |
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 slugify($text) { | |
$text = preg_replace('~[^\pL\d]+~u', '-', $text); | |
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); | |
$text = preg_replace('~[^-\w]+~', '', $text); | |
$text = preg_replace('~-+~', '-', $text); | |
$text = trim($text, '-'); | |
$text = strtolower($text); | |
if (empty($text)) { | |
return 'n-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
<?php | |
function getCotizaciones($monedas = true) | |
{ | |
$url = 'https://www.bcu.gub.uy/_layouts/BCU.Cotizaciones/handler/CotizacionesHandler.ashx?op=getcotizaciones'; | |
$data = ""; | |
$last_date_found = false; | |
$diff = 1; | |
$cotizaciones = array(); | |
$codigosAceptados = array("USD", "EURO", "CHF", "GBP", "ARS", "BRL", "JPY", "U.I."); |
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
upstream spa { | |
server webapp:2000; | |
} | |
upstream api { | |
server api:3000; | |
} | |
server { |
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
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initialising new SSH agent..." | |
(umask 066; /usr/bin/ssh-agent > "${SSH_ENV}") | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add -t 36000; # Lifetime only for 10 hours | |
} | |
# Source SSH settings, if applicable |
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
FROM node:8.9.4-alpine | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
COPY ./src/package.json /usr/src/app | |
RUN yarn | |
COPY ./src/. /usr/src/app/ | |
RUN yarn global add http-server |
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
db.tweets.aggregate( | |
{ | |
$project: { | |
y: { $year: "$created_at"}, | |
m: { $month: "$created_at"}, | |
d: { $dayOfMonth: "$created_at"}, | |
h: { $hour: "$created_at"}, | |
tweet: 1 | |
} | |
}, |
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
First "gem install sass" on console | |
Go Menu File > Settings > Tools > File Watch > "+" > "sass" | |
On New Window > Section Watcher Settings | |
Program: /<home-directory>/.gem/ruby/2.5.0/bin/sass | |
Arguments: --no-cache --update --no-cache --update $FileName$:../css/$FileNameWithoutExtension$.css --style compressed | |
Compile sass file on folder css on file minified |
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
[Unit] | |
Description=gunicorn daemon | |
After=network.target | |
After=syslog.target | |
[Service] | |
User=nginx | |
Group=nginx | |
EnvironmentFile=/etc/api.gunicorn | |
WorkingDirectory=/var/webapps/api |
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
upstream django_app_server { | |
server unix:/var/webapps/django/api.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name _; | |
client_max_body_size 4G; |