Skip to content

Instantly share code, notes, and snippets.

Working from home

Rodrigo Espinoza rodrigoespinozadev

Working from home
View GitHub Profile
View Using FutureBuilder Example
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() => runApp(MaterialApp(
home: MyApp(),
rodrigoespinozadev / resize_image.php
Created Jul 2, 2020 — forked from janzikan/resize_image.php
PHP: Resize image - preserve ratio of width and height
View resize_image.php
* Resize image - preserve ratio of width and height.
* @param string $sourceImage path to source JPEG image
* @param string $targetImage path to final JPEG image file
* @param int $maxWidth maximum width of final image (value 0 - width is optional)
* @param int $maxHeight maximum height of final image (value 0 - height is optional)
* @param int $quality quality of final image (0-100)
* @return bool
function resizeImage($sourceImage, $targetImage, $maxWidth, $maxHeight, $quality = 80)
//npm modules
const express = require('express');
const uuid = require('uuid/v4')
const session = require('express-session')
const FileStore = require('session-file-store')(session);
const bodyParser = require('body-parser');
const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
const axios = require('axios');
rodrigoespinozadev / array_flatten.php
Created Jun 13, 2020 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
View array_flatten.php
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, |
* @param array $array The multi-dimensional array.
* @return array
function array_flatten($array) {
if (!is_array($array)) {
rodrigoespinozadev / parse_dotenv.bash
Created Apr 20, 2020 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
rodrigoespinozadev /
Created Apr 9, 2020 — forked from 50percentgrey/
Delete-Clean Unnecessary files / Apple / Xcode
# Delete Archived Applications
rm -r ~/Library/Developer/Xcode/Archives/*/
# Delete Devired Data
rm -r ~/Library/Developer/Xcode/DerivedData/*/
# Delete Apple cached files
rm -r ~/Library/Developer/CoreSimulator/Caches/dyld/*/*/
rodrigoespinozadev / Dockerfile
Created Jan 11, 2020 — forked from Mikulas/Dockerfile
Docker image PHP 7.1 alpine with extensions
View Dockerfile
FROM php:7.1-fpm-alpine
RUN apk add --update \
autoconf \
g++ \
libtool \
make \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install mysqli \
View ActionTypes.js
'use statics';
export default {
rodrigoespinozadev /
Created Dec 31, 2019 — forked from joepie91/
Rendering pages server-side with Express (and Pug)


  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
rodrigoespinozadev / my.cnf
Created Dec 6, 2019 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
View my.cnf
# Optimized my.cnf configuration for MySQL/MariaSQL
# by Fotis Evangelou, developer of Engintron (
# === Updated December 2018 ===
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
You can’t perform that action at this time.