Skip to content

Instantly share code, notes, and snippets.

View mtangoo's full-sized avatar
💭
Praising God while coding!

Stefano D. Mtangoo mtangoo

💭
Praising God while coding!
View GitHub Profile
@mtangoo
mtangoo / sms-sender.php
Created July 4, 2019 11:37
Send HTTP to Ozek SMS server
// Make sure that you are in same web directory as your project root
// Install guzzle with composer
// composer require guzzlehttp/guzzle:~6.0
<?php
require_once('vendor/autoload.php'); //don't add this if you are using a framework
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
@mtangoo
mtangoo / psql-with-gzip-cheatsheet.sh
Created February 6, 2019 15:01 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@mtangoo
mtangoo / nationalities.php
Created December 27, 2017 23:34 — forked from zspine/nationalities.php
PHP Nationalities Array
$nationals = array(
'Afghan',
'Albanian',
'Algerian',
'American',
'Andorran',
'Angolan',
'Antiguans',
'Argentinean',
'Armenian',
@mtangoo
mtangoo / .gitignore
Created September 14, 2017 10:58 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@mtangoo
mtangoo / README.markdown
Created August 2, 2017 18:32 — forked from marijn/README.markdown
List of countries in YAML, CSV and TXT format

#List of countries

It's time someone compiled a list of countries to use within a web application. This gist attempts to make a first move at that.

List of nationalities

I've also compiled a list of nationalities

@mtangoo
mtangoo / README.markdown
Created August 2, 2017 18:32 — forked from marijn/README.markdown
List of nationalities in YAML, CSV and TXT format

List of nationalities

It's time someone compiled a list of nationalities to use within a web application. This gist attempts to make a first move at that.

##List of countries

I've also compiled a list of countries

@mtangoo
mtangoo / lldb_cheat_sheet.md
Created March 20, 2017 16:47 — forked from ryanchang/lldb_cheat_sheet.md
LLDB Cheat Sheet

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type
@mtangoo
mtangoo / gist:21d9b47694d05f77d683a2b5cece318e
Created January 2, 2017 12:21 — forked from prsws/gist:8162386
A Multi-Tenant Strategy using Yii and MySQL

Introduction

This article describes an implementation of multi-tenancy using Yii and MySQL. “Multi-tenancy” is but one (yet crucial) aspect of SaaS applications; refer to the IBM document Convert your web application to a multi-tenant SaaS solution for more information on what else makes a webapp a SaaS application.

Moreover, there are three main architectures for multi-tenant databases: separate database, separate schemas and a single database. Refer to the Microsoft document Multi-Tenant Data Architecture for more information.

As MySQL doesn’t have schemas (at least the same way MS SQL Server and Oracle do) the only choices are a separate database for each tenant and single database with “commingled” tenant data. SaaS applications with a relatively small number of tenants can be easily managed with a database for each one, but for large numbers of tenants its

@mtangoo
mtangoo / config.php
Created October 5, 2016 08:01 — forked from SilverFire/config.php
Yii2 set timezone for DB connection
<?php
return [
'components' => [
'db' => [
'class' => '\yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;dbname=demo',
'username' => 'root',
'password' => '',
'charset' => 'utf8',