Skip to content

Instantly share code, notes, and snippets.

@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;
@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 / 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 / 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 / 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 / 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 / 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 / ricerca_jquery.html
Last active August 27, 2018 13:18
Ricerca / filtro real-time in jQuery
<h2 align="center">Ricerca real-time in jQuery</h2>
<br/>
<div class="row ">
<div class="panel-group">
<input type="text" id="filtro" class="form-control" placeholder="Cerca qualcosa, ad esempio 'spaghetti'" />
<br/>
<div class="contenuto">
A Milano ci sono degli ottimi ristoranti!
@portapipe
portapipe / dragdropfile.html
Last active July 18, 2018 10:09
Drag&Drop native file upload jQuery
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.js"></script>
<style>
.dropzones{
border: 2px dashed grey;
height: 80px;
text-align: center;
padding-top: 40px;
cursor: pointer;
@portapipe
portapipe / calendar.html
Created July 11, 2018 13:44
DatePicker calendar: the quickest way
<!-- Bootstrap (comment it if you've already loaded it) -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- datePicker -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<!-- Fontawesome... you must have it always! => -->
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">