Skip to content

Instantly share code, notes, and snippets.

View massiws's full-sized avatar

Massimo Simonini massiws

  • Simonini informatica
  • Milan, Italy
  • X @massiws
View GitHub Profile
@massiws
massiws / readme.sh
Created June 6, 2021 14:04
Install Samsung M2070 FW printer/scanner in Mint/Ubuntu
# Download last official driver
# (see here https://support.hp.com/de-de/drivers/selfservice/samsung-xpress-sl-m2070-laser-multifunction-printer-series/16450377)
wget https://ftp.hp.com/pub/softlib/software13/printers/SS/SL-M4580FX/uld_V1.00.39_01.17.tar.gz
# Unpack archive:
tar -xf uld_V1.00.39_01.17.tar.gz
# Move into driver folder:
cd uld
@massiws
massiws / custom.cnf
Created November 18, 2020 16:26
Devilbox config for PHP/MySQL/xDebug in VSCode
; Disable ONLY_FULL_GROUP_BY MySQL option in Devilbox
;
; Add a file cfg/mysql-X.Y/custom.cnf (or any filename with .cnf extension)
; make sure to fit your "X.Y" MySQL version!
[mysqld]
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
@massiws
massiws / user-settings.json
Created January 8, 2018 22:47
VSCode: User Settings for PHP development
{
"workbench.iconTheme": "eq-material-theme-icons",
"editor.fontSize": 16,
"window.zoomLevel": 0,
"emmet.triggerExpansionOnTab": true,
"sublimeTextKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"workbench.colorTheme": "Monokai Dark Soda",
@massiws
massiws / gulpfile.js
Created May 29, 2017 15:09
Simple Gulp boilerplate
/**
* Gulp boilerplate
*
* Requirements:
* - NodeJS (https://nodejs.org/)
* - Gulp (http://gulpjs.com/)
*
* Start new project:
* ```
* mkdir project-name
@massiws
massiws / my_common.inc
Last active March 26, 2017 01:48
Drupal 7: date format conversion
<?php
/**
* Date conversion class.
*/
class DateFormat {
/**
* Date format conversion.
*
@massiws
massiws / template.php
Last active March 26, 2017 01:47
Drupal 7: display username in user-menu block title
<?php
/**
* Implements MY_THEME_preprocess_block().
*/
function MY_THEME_preprocess_block(&$variables) {
global $user;
$block =& $variables['block'];
if ($block->module == 'system' && $block->delta == 'user-menu' && user_is_logged_in()) {
@massiws
massiws / msw_custom.module
Last active February 4, 2016 12:40
Drupal: change maxlength and size of description field in default upload widget
<?php
/**
* @file
* The description used as label of the link to the uploaded file has default lentgh=128 and size=60.
* With this function inside your custom module you can change these (and other) default options.
*/
/**
* Implements hook_preprocess_file_widget().
*/
@massiws
massiws / my_module.install
Last active October 12, 2016 23:57
Create custom vocabulary and terms in Drupal 7
<?php
/**
* Implements hook_install().
*/
function my_module_install() {
// Create a new vocabulary, if don't exists
$vmn = 'my_vocabulary'; // Vocabulary Machine Name
$voc = taxonomy_vocabulary_machine_name_load($vmn);
if (!$voc) {
@massiws
massiws / customodule.install
Created November 14, 2015 16:04
Drupal 7: create custom content type in custom module
<?php
/**
* Implements hook_install().
*/
function customodule_install() {
node_types_rebuild();
$types = node_type_get_types();
node_add_body_field($types['my_content_type']);
add_custom_fields();
@massiws
massiws / toggle_div.html
Created July 31, 2014 00:16
JQUERY: Toggle DIVs with radio buttons
<html>
<head>
<title>Toggle DIVs with radio buttons</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$("[name=toggler]").click(function(){
$('.hide').hide();
$("#div-" + $(this).val()).show();
});