Skip to content

Instantly share code, notes, and snippets.

View MartelliEnrico's full-sized avatar
🏠
Working from home

Enrico Martelli MartelliEnrico

🏠
Working from home
View GitHub Profile
@simonesestito
simonesestito / layout_with_fab.xml
Created August 5, 2018 16:22
Extended FAB using Material Components on Android
<?xml version="1.0" encoding="utf-8"?><!--
~ Use Extended FAB on Android even if Material Components doesn't support it yet
~ See https://github.com/material-components/material-components-android/issues/79
~
~ Created by Simone Sestito
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
import android.app.Activity
import android.app.Dialog
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.Point
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.support.design.widget.BottomSheetBehavior
import android.support.design.widget.CoordinatorLayout
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active October 31, 2024 11:35
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@elihart
elihart / EpoxyGlidePreloader.kt
Last active October 18, 2021 14:47
Utility to set up a RecyclerView scroll listener that enables preloading support with Glide in Epoxy library usages.
package com.airbnb.epoxy
import android.content.Context
import android.graphics.Bitmap
import android.support.annotation.IdRes
import android.support.annotation.Px
import android.support.v7.widget.RecyclerView
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestBuilder
@sohlich
sohlich / db2_error_codes
Created October 3, 2017 07:40
DB2 error codes and reason description
DB2 SQL-Error: -007 SQLState: 42601
Short Description: STATEMENT CONTAINS THE ILLEGAL CHARACTER
The specified 'character' is not a valid character in SQL statements. System action: The statement cannot be executed. Programmer response: Correct the syntax and resubmit the statement. Refer to Chapter 2 of DB2 SQL Reference for information about the valid SQL character set.
DB2 SQL-Error: -010 SQLState: 42603
Short Description: THE STRING CONSTANT BEGINNING IS NOT TERMINATED
The statement contains a string constant, beginning with 'string', that is not terminated properly. System action: The statement cannot be executed. Programmer response: Examine the statement for missing quotation marks or apostrophes in the indicated string constant.
DB2 SQL-Error: -029 SQLState: 42601
Short Description: INTO CLAUSE REQUIRED
const admin = require("admin");
function getFirebaseUser(req, res, next) {
console.log("Check if request is authorized with Firebase ID token");
if (
!req.headers.authorization ||
!req.headers.authorization.startsWith("Bearer ")
) {
console.error(
"No Firebase ID token was passed as a Bearer token in the Authorization header.",
@bendc
bendc / simulate-typing.js
Created September 1, 2017 08:57
Fake typing animation
const trackTime = timing => {
const now = performance.now();
if (!timing.startTime) timing.startTime = now;
const elapsed = now - timing.startTime;
const {duration} = timing;
if (duration != null && duration <= elapsed) timing.startTime = null;
return elapsed;
};
const delay = (callback, duration) => {
@lurbas
lurbas / DuotoneColorFilter.java
Last active July 14, 2023 02:13
Duotone ColorFilter for Android
public ColorFilter duotoneColorFilter(@ColorInt int colorBlack, @ColorInt int colorWhite, float contrast) {
ColorMatrix cm = new ColorMatrix();
ColorMatrix cmBlackWhite = new ColorMatrix();
float lumR = 0.2125f;
float lumG = 0.7154f;
float lumB = 0.0721f;
float[] blackWhiteArray = new float[]{
lumR, lumG, lumB, 0, 0,
lumR, lumG, lumB, 0, 0,
@taylorotwell
taylorotwell / gist:68f614deb9538f2e30108c2698266fda
Last active May 28, 2020 08:41
ADR out of the box for Brandon
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
@LoveAndHappiness
LoveAndHappiness / gulpfile.js
Last active September 24, 2016 23:13
Laravel+Polymer Gulpfile
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var vulcanize = require('gulp-vulcanize');
// npm install --save-dev browser-sync gulp-vulcanize vulcanize
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------