Skip to content

Instantly share code, notes, and snippets.

@epintos
epintos / mediumStoriesStats.js
Last active January 22, 2023 10:39
Export Medium Stats Stores to CSV
// Run Inspector Console in chrome and copy and paste the following code in the /stats/stories view
function download(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
@epintos
epintos / main.yml
Created August 14, 2020 09:45
Apiary Github Action
name: Deploy API Documentation
on:
push:
branches:
- master
jobs:
deploy-doc-apiary:
name: Push API doc to Apiary
@epintos
epintos / Gemfile
Last active July 4, 2018 15:12
Authentication For Rails Training
# ....
gem 'versionist'
gem 'jwt'
# ....
@epintos
epintos / [Jenkins] Build Execute Shell
Last active March 12, 2018 13:38
Ruby on Rails Continuous Integration with Jenkins and Docker Compose
#!/bin/bash +x
set -e
# Remove unnecessary files
echo -e "\033[34mRemoving unnecessary files...\033[0m"
rm -f log/*.log &> /dev/null || true &> /dev/null
rm -rf public/uploads/* &> /dev/null || true &> /dev/null
# Build Project
echo -e "\033[34mBuilding Project...\033[0m"
@epintos
epintos / s3.js
Last active November 20, 2017 06:47
Angular Gulp S3 Deploy
var gulp = require('gulp'),
awspublish = require('gulp-awspublish');
var localConfig = {
buildSrc: './build/**/*',
getAwsConf: function (environment) {
var conf = require('../../config/aws');
if (!conf[environment]) {
throw 'No aws conf for env: ' + environment;
}
@epintos
epintos / mediumOverviewStats.js
Created January 20, 2017 20:21
Export Medium Overview Stats to CSV
// Max value of the Minutes Read Graph
minutesReadMaxAxis = 810
// Max value of the Views Graph
viewsMaxAxis = 431
// Max value of the Visitors Graph
visitorsMaxAxis = 344
// First date of the graph (US Format)
initialDay = new Date('12/22/2016')
// Days in the graphs
@epintos
epintos / [Jenkins] Post-build Actions Execute Shell
Created June 25, 2015 23:44
Ruby on Rails Continuous Integration with Jenkins and Docker Compose
#!/bin/bash +x
docker-compose --project-name=${JOB_NAME} stop &> /dev/null || true &> /dev/null
docker-compose --project-name=${JOB_NAME} rm --force &> /dev/null || true &> /dev/null
docker stop `docker ps -a -q -f status=exited` &> /dev/null || true &> /dev/null
docker rm -v `docker ps -a -q -f status=exited` &> /dev/null || true &> /dev/null
docker rmi `docker images --filter 'dangling=true' -q --no-trunc` &> /dev/null || true &> /dev/null
@epintos
epintos / docker-compose.yml
Last active October 29, 2016 14:33
Ruby on Rails Continuous Integration with Jenkins and Docker Compose
db:
image: postgres
ports:
- "5432"
redis:
image: redis
ports:
- "6379"
@epintos
epintos / gist:f2ba43a47bca53a2a6c4
Last active May 22, 2016 19:11
Angular S3 Static Setup
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>your-app-dns</HostName>
<Protocol>https</Protocol>
<ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith>
</Redirect>
@epintos
epintos / 0010_sidekiq.config
Created April 29, 2016 14:50
AWS Elastic Beanstalk Sidekiq Config File
# Original: http://www.snip2code.com/Snippet/256399/Amazon-Elastic-Beanstalk-Sidekiq
commands:
create_pre_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/pre"
ignoreErrors: true
create_post_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
create_restartappserver_pre_dir:
command: "mkdir /opt/elasticbeanstalk/hooks/restartappserver/pre"