Skip to content

Instantly share code, notes, and snippets.

View stramargio's full-sized avatar

Andrea Margiovanni stramargio

View GitHub Profile

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@stramargio
stramargio / gas-light.css
Created June 4, 2023 04:19
GoToSocial light-mode css
:root {
--lightbrown: #efefef;
}
body {
background: var(--white1);
color: var(--bg);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
@stramargio
stramargio / quad9-dotls.mobileconfig
Last active February 24, 2021 11:55
Quad9 configuration profile for macOS Big Sur and iOS 14+: secured w/ECS (Malware blocking, DNSSEC Validation, ECS enabled)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>Name</key>
<string>Quad9 DNS over TLS</string>
<key>PayloadDescription</key>
@stramargio
stramargio / git-good-commit.md
Created January 20, 2021 09:58
Good commit message

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about

Keybase proof

I hereby claim:

  • I am stramargio on github.
  • I am margiovannia (https://keybase.io/margiovannia) on keybase.
  • I have a public key ASBl1ptp-cNfN6KVFcQAwk06rK5lOn-ir67DPROS4DW5nwo

To claim this, I am signing this object:

using System;
namespace Extensions
{
public static class TryParseOrElseExtension
{
public static int TryParseOrElse(this string value, int orElse)
{
try {
return int.Parse(value);
@stramargio
stramargio / wp_is_mobile_phone.php
Created February 16, 2017 15:06
detect only mobile phones
function isMobilePhone() {
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|
@stramargio
stramargio / deviceDetection.php
Created February 16, 2017 14:36
Check if is a mobile device, tablet or desktop.
<?php
$tablet_browser = 0;
$mobile_browser = 0;
if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
$tablet_browser++;
}
@stramargio
stramargio / Preferences.sublime-settings
Created October 28, 2016 15:37
CONFIGURAZIONE SUBLIME TEXT
{
"color_scheme": "Packages/User/SublimeLinter/Monokai Extended (SL).tmTheme",
"draw_minimap_border": true,
"font_size": 11,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"margin": 2,
@stramargio
stramargio / gist:43a7dfde6a319d55e5804c5ab4e8b708
Created October 28, 2016 07:47
fusi ora solare relativi a UTC
DE +1
AT +1
FR +1
SP +1
UK +0
BE +1
NL +1
LU +1
DK +1
FI +2