Skip to content

Instantly share code, notes, and snippets.

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

Rodrigo Espinoza rodrigoespinozadev

🏠
Working from home
View GitHub Profile
import 'package:get/get.dart';
class CountController extends GetxController
{
var count=0.obs;
void increment()
{
count++;
}
@rodrigoespinozadev
rodrigoespinozadev / gist:391abd54359f83c5d927599f34ed2123
Created January 22, 2022 23:44 — forked from pingwping/gist:92219a8a1e9d44e1dd8a
Create and update embedded documents with MongoEngine
# REF: http://www.quora.com/How-do-I-create-and-update-embedded-documents-with-MongoEngine
class Comment(EmbeddedDocument):
content = StringField()
name = StringField(max_length=120)
class Post(Document):
title = StringField(max_length=120, required=True)
author = StringField(required=True)
@rodrigoespinozadev
rodrigoespinozadev / gcp.tf
Created December 19, 2021 04:41 — forked from ashmore11/gcp.tf
Next Strapi Cloud Run (Terraform GCP)
provider "google" {
region = var.gcp_region
}
resource "random_id" "id" {
byte_length = 2
prefix = "${replace(lower(var.gcp_project_name), "/\\s+/", "-")}-"
}
resource "google_project" "project" {
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
rodrigoespinozadev / resize_image.php
Created July 2, 2020 23:04 — forked from janzikan/resize_image.php
PHP: Resize image - preserve ratio of width and height
/**
* 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
rodrigoespinozadev / array_flatten.php
Created June 13, 2020 18:00 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
<?php
/**
* Convert a multi-dimensional array into a single-dimensional array.
* @author Sean Cannon, LitmusBox.com | seanc@litmusbox.com
* @param array $array The multi-dimensional array.
* @return array
*/
function array_flatten($array) {
if (!is_array($array)) {
@rodrigoespinozadev
rodrigoespinozadev / parse_dotenv.bash
Created April 20, 2020 15:29 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using 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
rodrigoespinozadev / apple.sh
Created April 9, 2020 17:06 — forked from 50percentgrey/apple.sh
Delete-Clean Unnecessary files / Apple / Xcode
#!/bin/bash
# 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
rodrigoespinozadev / Dockerfile
Created January 11, 2020 19:23 — forked from Mikulas/Dockerfile
Docker image PHP 7.1 alpine with extensions
FROM php:7.1-fpm-alpine
RUN apk add --update \
autoconf \
g++ \
libtool \
make \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install mysqli \