Skip to content

Instantly share code, notes, and snippets.

View dafi's full-sized avatar

Davide Ficano dafi

View GitHub Profile
@dafi
dafi / mylinks.json
Last active April 1, 2024 07:16
Sample mylinks configuration file
@dafi
dafi / catalina-quarantine.sh
Created April 26, 2020 12:46
Stop Catalina verifying file at startup time
# Stop Catalina verifying file at startup time
sudo xattr -dr com.apple.quarantine /Applications/AppName.app
#!/bin/bash
# Restore attribute from unzipped files
# When Finder unzip files it marks them as in "quarantine"
# so we restore the correct permission
xattr -dr com.apple.quarantine $1
# remove execute attribute
# chmod -x $(git ls-files --modified)

Rebase pushed branch on master

This is an abstract from carbonfive post blogs

Pull master branch

git pull origin master

Create bug/feature branch

@dafi
dafi / MaximumLineLength.kt
Created December 15, 2019 10:52
Bug test for detekt ignoring MaximumLineLength and MaxLineLength at function definition level
// Work only at file declaration level
// @file:Suppress("MaximumLineLength", "MaxLineLength")
package com.ternaryop.photoshelf.activity
import android.webkit.WebView
class MaximumLineLength {
@Suppress("MaximumLineLength", "MaxLineLength")
fun dummyFunction(view: WebView) {
view.loadUrl("javascript:var img = document.querySelector('img');dimRetriever.setDimensions(img.width, img.height)")
@dafi
dafi / OverviewResource.java
Created May 29, 2018 04:20 — forked from wonderb0lt/OverviewResource.java
A JAX-RS resource that shows all bound methods in the current context (RestEasy only)
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@dafi
dafi / klint2logcat.sh
Last active February 11, 2018 15:35
Show ktlint results on logcat to simplify navigation between warnings
#/bin/bash
# Run klint (https://github.com/shyiko/ktlint) and then write the result to logcat
# The file names are clickeable from Android Studio
tag_name="klint"
tmpfile=$(mktemp)
chmod +x $tmpfile
dquote='"'
ktlint "app/src/**/*kt" \
@dafi
dafi / TopCropImageView.java
Created May 6, 2017 13:13 — forked from arriolac/TopCropImageView.java
Custom Android ImageView for top-crop scaling of the contained drawable.
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
/**
* Created by chris on 7/27/16.
@dafi
dafi / apple_naming_convention.md
Created January 17, 2016 10:48
Regular Expressions used in XCode to find/replace specific methods

Regular Expressions used in XCode to find/replace specific methods

Find Objective-c methods declared without keywords before arguments

Apple rules described here require "keywords before all arguments", to find them in your code use the following regular expression

^[+-]\s+\(.*?\).*:\s?\(.*?\).*?\s+: