Skip to content

Instantly share code, notes, and snippets.

View icaroscherma's full-sized avatar
🏖️
Escaping northern winter.

Icaro Scherma icaroscherma

🏖️
Escaping northern winter.
  • Canada
  • 06:54 (UTC -07:00)
View GitHub Profile
@icaroscherma
icaroscherma / install.sh
Created May 21, 2019 14:36
Installing a LAMP-like env in AWS Ubuntu 18.04
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo sh -c "echo 'deb [arch=amd64,i386] https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB-10.2.list"
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo dpkg-reconfigure locales
sudo apt update
sudo apt upgrade
sudo apt install unzip
sudo apt install mariadb-server mariadb-client
@icaroscherma
icaroscherma / EloquentModel.php
Created March 28, 2019 18:10
Using Eloquent Model without the whole Laravel structure
<?php
class EloquentModel extends Illuminate\Database\Eloquent\Model {
public function getConnection()
{
// In case of Phalcon 3.4
$di = new \Phalcon\Di();
$config = $di->getDefault()->getShared('config');
$db = $config['database'];
$host = explode(':', $db->host);
@icaroscherma
icaroscherma / shell.sh
Created November 30, 2016 18:34
Add more languages to a docker container
# replace 'pt_BR' for the desired language
sed -i -e 's/# pt_BR.UTF-8 UTF-8/pt_BR.UTF-8 UTF-8/' /etc/locale.gen && \
echo 'LANG="pt_BR.UTF-8"'>/etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=pt_BR.UTF-8
@icaroscherma
icaroscherma / cake3auth_finder.php
Last active April 1, 2016 23:45
CakePHP 3: Migrating from scope to finder (auth)
<?php
// src/Controller/AppController.php
$this->loadComponent('Auth', [
'authenticate' => [
'Form' => [
'fields' => [
'username' => 'email',
'password' => 'password'
],
// Older "scope" / "contain"
@icaroscherma
icaroscherma / controller.js
Last active March 31, 2017 11:33
Ionic Sample: Confirm Popup with checkbox
// Using show()
$scope.garageToggle = function() {
$scope.data = { hasWorkEntry: true };
$ionicPopup.show({
title: 'Are you sure you want to open the garage?',
content: '<ion-checkbox ng-model="data.hasWorkEntry" ng-checked="data.hasWorkEntry">Mark as Work Entry?</ion-checkbox>',
scope: $scope,
buttons: [
{text: 'Cancel'},