Skip to content

Instantly share code, notes, and snippets.

View marcosrocha85's full-sized avatar
🤓

Marcos Rocha marcosrocha85

🤓
View GitHub Profile
@marcosrocha85
marcosrocha85 / AssociatedProtocol.swift
Created October 19, 2021 19:31 — forked from benrudhart/AssociatedProtocol
A Swift protocol that is using an enum with a generic associated type
import Foundation
import UIKit
//: # The problem: Protocol that is using an enum with generic associated type
enum GenericEnum<T> {
case Unassociated
case Associated(T)
}
@marcosrocha85
marcosrocha85 / RobotEntertainerMiddleware.php
Created December 5, 2019 02:29
Laravel Robot Entertainer
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Arr;
class RobotEntertainerMiddleware
{
const prohibitedRoutes = [
@marcosrocha85
marcosrocha85 / HttpCodes.php
Created April 10, 2019 16:58
PHP Response Codes for API Implementation
<?php
/**
* This class is used in a Laravel/Lumen project. But it may be fit in any project as well
* User: marcosrocha85
* Date: 2019-04-10
* Time: 11:51
*/
namespace App\Exceptions;
@marcosrocha85
marcosrocha85 / form_pretty_checkbox.php
Last active September 24, 2018 18:48
CodeIgniter form_pretty_checkbox
/**
* Pretty Checkbox Field for CodeIgniter and pretty-checkbox-vue from @hamed-ehtesham
*
* @access public
* @param mixed
* @param string
* @param bool
* @param string
* @return string
*/
@marcosrocha85
marcosrocha85 / AutoResizeTextView.java
Created December 19, 2016 13:05
Android: Auto Scale TextView
package com.example.AutoResizeTextView;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextPaint;