Skip to content

Instantly share code, notes, and snippets.

Gianluigi A35G

Block or report user

Report or block A35G

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
A35G / check_push_token.php
Created Sep 21, 2017
Is your device's Token for Push Notifications valid yet? Check it out now!
View check_push_token.php
class PushMessage {
private $url = '';
private $serverApiKey = "";
private $devices = array();
function __construct($apiKeyIn){
$this->serverApiKey = $apiKeyIn;
A35G / easter_egg.js
Created Jan 21, 2016
Pieces of code useful for sketching an easter egg in a website or a web app. By entering a word or a sequence of characters / symbols / or other, it is possible to perform a function if the condition is true; In case of 5 second pause between typing and the other, the sequence is emptied.
View easter_egg.js
var sequence = '';
var timeout;
var reset_s = function() {
sequence = '';
$(document).on("keypress", function(event) {
A35G / convert_csv_to_vcf.php
Last active Jan 17, 2016
CSV to VCF - Convert file for import Contacts
View convert_csv_to_vcf.php
$csv_file = __DIR__."/contacts.csv";
* Structure of the CSV file
* "Title","First Name","Middle Name","Last Name","Suffix","Company","Department","Job Title","Business Street","Business Street 2","Business Street 3","Business City","Business State","Business Postal Code","Business Country/Region","Home Street","Home Street 2","Home Street 3","Home City","Home State","Home Postal Code","Home Country/Region","Other Street","Other Street 2","Other Street 3","Other City","Other State","Other Postal Code","Other Country/Region","Assistant's Phone","Business Fax","Business Phone","Business Phone 2","Callback","Car Phone","Company Main Phone","Home Fax","Home Phone","Home Phone 2","ISDN","Mobile Phone","Other Fax","Other Phone","Pager","Primary Phone","Radio Phone","TTY/TDD Phone","Telex","Account","Anniversary","Assistant's Name","Billing Information","Birthday","Business Address PO Box","Categories","Children","Directory Server","E-mail Address","E-mail Type","E-mail Display Name","E-mail 2 Address","
A35G / Base_url.js
Last active Sep 3, 2015
Get the address of the website or web application
View Base_url.js
function getBaseURL() {
var url = location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));
if (baseURL.indexOf('http://localhost') != -1) {
var url = location.href;
var pathname = location.pathname;
var index1 = url.indexOf(pathname);
A35G / customErrorHandler.php
Created May 27, 2015
Custom Script to manage Error Log in PHP
View customErrorHandler.php
function customErrorHandler($errno, $errstr, $errfile, $errline) {
if (!(error_reporting() & $errno))
return true;
switch ($errno) {
A35G / date_payments.php
Created Nov 6, 2014
Through a date given as input, it returns the same date or the first date to make a payment by a deadline. A check is performed on the specified date, to see if the same appears as Italian festivity.
View date_payments.php
// Check if var is a valid date
function validateDate($date, $format = 'Y-m-d H:i:s') {
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
A35G / detect_library.js
Last active Aug 29, 2015
How to detect if an external library has loaded
View detect_library.js
window.create_widget = function() {
if (jQuery("#box-dynamic").length)
$('#box-dynamic').html("Oh Yes");
window.loadjQuery = function(url, success) {
var script = document.createElement('script');
A35G / Search and replace words with blacklist - v2
Created May 22, 2014
Search and replace words (using random characters) contained in a text, using blacklists - Optimized version
View Search and replace words with blacklist - v2
* Search and replace words with blacklist - v. 0.2
* ------------------------------------------------------------
* Optimized version - Thanks to my friend:
* Flavio 'darkjoker' Giobergia -
* ------------------------------------------------------------
* The generation of random characters, has been eliminated, to make
A35G / Search and replace words with blacklist
Created May 20, 2014
Search and replace words (using random characters) contained in a text, using blacklists
View Search and replace words with blacklist
// Text to filter and to censure
$text_to_check = "Lorem ipsum DOLOR Bullshit";
// List of words to censor
$blacklist_words = array("God", "em", "shit", "pig");
//$blacklist_words = "shit";
// Function used to generate a random string length as word to replace
A35G / Check Link and Filter text
Created Apr 10, 2014
A function simple and quick for a dummy control on a text for the presence of any link. Useful for a first check on the body of an e-mail composed by a contact form
View Check Link and Filter text
You can’t perform that action at this time.