Skip to content

Instantly share code, notes, and snippets.

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

Johan Garcia driff

🏠
Working from home
  • Santiago, Chile
View GitHub Profile
@driff
driff / MinMaxAttribute.cs
Created November 29, 2017 19:21 — forked from LotteMakesStuff/MinMaxAttribute.cs
MinMax property drawer for Unity - Add a [MinMax] attribute to a property to draw a useful min/max setting slider.
// NOTE DONT put in an editor folder
using UnityEngine;
public class MinMaxAttribute : PropertyAttribute
{
public float MinLimit = 0;
public float MaxLimit = 1;
public MinMaxAttribute(int min, int max)
@driff
driff / deploy-static-site-heroku.md
Created February 8, 2018 15:00 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@driff
driff / deploy-static-site-heroku.md
Created February 8, 2018 15:00 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@driff
driff / log.js
Created February 19, 2018 17:52 — forked from vikas5914/log.js
Custom Logger Library with winston
var winston = require('winston')
// set default log level.
var logLevel = 'info'
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'blue',
@driff
driff / log.js
Created February 19, 2018 17:52 — forked from vikas5914/log.js
Custom Logger Library with winston
var winston = require('winston')
// set default log level.
var logLevel = 'info'
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'blue',
import android.support.design.widget.TabLayout
//Listener for TabLayout.AddOnTabSelectedListener
fun TabLayout.onTabSelectedListener(function: __TabLayout_onTabSelectedListener.() -> Unit) {
val listener = __TabLayout_onTabSelectedListener()
listener.function()
addOnTabSelectedListener(listener)
}
class __TabLayout_onTabSelectedListener : TabLayout.OnTabSelectedListener{
@driff
driff / RxJava.md
Created June 12, 2018 22:05 — forked from cesarferreira/RxJava.md
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@driff
driff / ApiClient.java
Last active February 6, 2019 05:20
Retrofit refresh token
//FROM https://www.coderdump.net/2018/04/automatic-refresh-api-token-with-retrofit-and-okhttp-authenticator.html
public class ApiClient {
private static Retrofit retrofitRefresh = null;
private static Retrofit retrofit = null;
public static Retrofit getAdapterRefresh() {
if (retrofitRefresh==null) {
final OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(new Interceptor() {
@Override
@driff
driff / audit.yml
Created February 20, 2024 23:47 — forked from LukeMathWalker/audit.yml
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit: