Skip to content

Instantly share code, notes, and snippets.

Fabrizio Caldarelli FabrizioCaldarelli

Block or report user

Report or block FabrizioCaldarelli

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
@FabrizioCaldarelli
FabrizioCaldarelli / ExpoIconSelector.js
Created Aug 17, 2019
Expo Icon Selector for React Native
View ExpoIconSelector.js
import React from "react";
import { View } from "react-native";
import { AntDesign, Entypo, EvilIcons, Feather, FontAwesome, FontAwesome5, Foundation, Ionicons, MaterialCommunityIcons, MaterialIcons, Octicons, SimpleLineIcons, Zocial } from '@expo/vector-icons';
export default class ExpoIconSelector extends React.Component {
render() {
return (
View ItemSearch.php
class ItemSearch
{
public $dataoraAttraccoLocalized;
public $dataoraRipartenzaLocalized;
public function rules()
{
return [
[['dataoraAttraccoLocalized', 'dataoraRipartenzaLocalized', 'dataora_attracco', 'dataora_ripartenza', 'dataora_inserimento'], 'safe'],
View date-trait-query.php
<?php
class DateTraitQuery
{
public function andWhereDate($attribute, $value, $separators = ['/','-'])
{
$array = null;
foreach($separators as $separator)
{
if(strpos($value, $separator) !== false) $array = explode($separator, $value);
View ios-wkwebview-cookies.m
- (void)initWebView
{
// add session cookie to ajax calls
WKUserContentController* userContentController =
WKUserContentController.new;
WKUserScript * cookieScript =
[[WKUserScript alloc]
initWithSource: [[User sharedInstance] getJavscriptCookieString]
injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
View create-new-linux-service.md

1. Create a script and place in /etc/init.d (e.g /etc/init.d/myscript). The script should have the following format:

#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here....

# Source function library.
. /etc/init.d/functions
View keychain-with-touch-id.swift
// This two values identify the entry, together they become the
// primary key in the database
let myAttrService = "app_name"
let myAttrAccount = "first_name"
// DELETE keychain item (if present from previous run)
let delete_query: NSDictionary = [
kSecClass: kSecClassGenericPassword,
kSecAttrService: myAttrService,
View uitextfield-with-date-picker.swift
// Inizializza il selettore della data di nascita
dateBirthDatePicker = UIDatePicker()
dateBirthDatePicker?.datePickerMode = .date
txtDateBirth.inputView = dateBirthDatePicker
let dateBirthAccessory = UIToolbar()
dateBirthAccessory.sizeToFit()
dateBirthAccessory.items = [ UIBarButtonItem(title: "Done", style: .done, target: self, action: #selector(onDateBirthDateBtnDoneTapped)) ]
txtDateBirth.inputAccessoryView = dateBirthAccessory
@FabrizioCaldarelli
FabrizioCaldarelli / .htaccess
Created Mar 13, 2019
Add this entry to avoid that Apache truncates Authorization header
View .htaccess
<IfModule mod_setenvif.c>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>
View Plesk forward traffic through VPN.sh
iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -j SNAT --to 1.2.3.4
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl --system
@FabrizioCaldarelli
FabrizioCaldarelli / UIImageView-SFmobile.swift
Created Dec 17, 2018
UIImageView tint not change from xib
View UIImageView-SFmobile.swift
import UIKit
// fixing Bug in XCode
// http://openradar.appspot.com/18448072
extension UIImageView {
override open func awakeFromNib() {
super.awakeFromNib()
self.tintColorDidChange()
}
}
You can’t perform that action at this time.