Skip to content

Instantly share code, notes, and snippets.

@portapipe
portapipe / Email_model.php
Created October 12, 2018 12:21
Inviare email smtp con Gmail su Codeigniter (config + model)
<?php
class Email_model extends CI_Model {
private $nome_mittente = "La Mia Azienda";
public function __construct()
{
parent::__construct();
//La configurazione è nella cartella config/email.php
$this->load->library("email");
@portapipe
portapipe / datatables_json_generator.php
Last active June 21, 2019 12:58
PHP code to create a datatables.net compatible JSON output for ajax data type
<?php
$max_rows = 100;
$num_columns = 20;
for($i=0;$i<$max_rows;$i++){
$array = array();
for($n=0;$n<$num_columns;$n++){
$array[] = bin2hex(rand(1000,9999));
}
@portapipe
portapipe / binary_combinations.php
Created October 1, 2019 09:31
PHP Binary combinations of a given length
<?
$bits = 4; //Number of combinations
for($i=0;$i<=(pow(2,$bits)-1);$i++){
$bin = str_pad(decbin($i), $bits, '0', STR_PAD_LEFT);
echo '<pre>';var_dump($bin);echo '</pre>';
}
@portapipe
portapipe / screensize.html
Created May 2, 2020 14:04
Bootstrap 4 Grid size in realtime
<div style="position: fixed; top:0; right: 0; opacity: 0.5; z-index: 100000;">
<div class="d-block d-sm-none">XS</div>
<div class="d-none d-sm-block d-md-none">SM</div>
<div class="d-none d-md-block d-lg-none">MD</div>
<div class="d-none d-lg-block d-xl-none">LG</div>
<div class="d-none d-xl-block">XL</div>
</div>
@portapipe
portapipe / example.php
Created May 27, 2020 11:04
Function to create list of class and functions of a list of given files
//This is an example for Codeigniter (v3 at the moment but it should work with any version)!
//Just copy and paste the code below into a controller you have
//Do some fine-tuning and choose the files you want to scan!
//...
//Here the class you want to put the function in
public function docs(){
echo '<h2>DOCS</h2>';
@portapipe
portapipe / PHPMail.php
Last active October 16, 2020 14:59
PHPMailer Library for Codeigniter - Keep the native email structure!
<?php
/**
* PHPMailer for Codeigniter - Keep the native email structure!
*
* @package CodeIgniter
* @subpackage Libraries
* @category Libraries
* @author https://github.com/portapipe
*
* @version 1.0
@portapipe
portapipe / compactFormFields.css
Created November 19, 2021 11:21
CompactFormFields for Bootstrap - HTML Select with label inside the top of the field itself
.compact-formfields > .form-label{
padding-top: 5px;
font-weight: 100;
margin-bottom: -10px !important;
background-color: white !important;
height: 42px;
width: 100%;
border: 1px solid #ddd;
padding-left: 11px;