Skip to content

Instantly share code, notes, and snippets.

View philipborbon's full-sized avatar

Philip Borbon philipborbon

View GitHub Profile
@philipborbon
philipborbon / HTTPStatusCodes.swift
Created December 4, 2018 02:24 — forked from brennanMKE/HTTPStatusCodes.swift
Swift Enums for HTTP Status Codes
enum HTTPStatusCodes: Int {
// 100 Informational
case Continue = 100
case SwitchingProtocols
case Processing
// 200 Success
case OK = 200
case Created
case Accepted
case NonAuthoritativeInformation
@philipborbon
philipborbon / ClickToSelectEditText.java
Created March 22, 2019 07:37 — forked from rodrigohenriques/ClickToSelectEditText.java
Used to make your EditText a better option than Spinners
public class ClickToSelectEditText<T extends Listable> extends AppCompactEditText {
List<T> mItems;
String[] mListableItems;
CharSequence mHint;
OnItemSelectedListener<T> onItemSelectedListener;
public ClickToSelectEditText(Context context) {
super(context);
@philipborbon
philipborbon / RetrofitSingleton.kt
Created May 20, 2019 08:23
Retrofit Singleton Factory
companion object Factory {
@Volatile
private var retrofit : Retrofit? = null
@Synchronized
fun getInstance(baseUrl: String, tokenStorage: TokenStorage): FireResponseService? {
retrofit = retrofit ?: synchronized(this) {
retrofit ?: buildRetrofit(baseUrl, tokenStorage)
}
@philipborbon
philipborbon / env.autoload.php
Created July 5, 2019 05:44
PHP .env Sample Implementation
<?php
/**
* Create .env file in same directory in following format
* DB_HOST=localhost
* DB_USERNAME=username
* DB_PASSWORD=password
*
*
* Usage:
*
@philipborbon
philipborbon / HeaderItemDecoration.kt
Last active October 7, 2019 03:23 — forked from filipkowicz/HeaderItemDecoration.kt
Item Decorator for sticky headers in Kotlin
/*
solution based on - based on Sevastyan answer on StackOverflow
changes:
- take to account views offsets
- transformed to Kotlin
- now works on viewHolders
- try to cache viewHolders between draw's
@philipborbon
philipborbon / .gitconfig
Last active October 7, 2019 03:25
Sample Git Config For Windows
[user]
name = Philip Borbon
email = philip@crescit.com
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
@philipborbon
philipborbon / sublime_projects.md
Created November 5, 2019 00:46
Create Projects in Sublime Text 3

Sublime Projects 📁

You can create Projects which contains multiple folders and can have individual settings depending on the project. A project is a folder or a group of folders saved at a certain state that will be remembered everytime you close the project.

You can also quick switch between projects with CMD + CTRL + P or CTRL + ALT + P

If your are using Atom or vscode there is a plugin to add this behavior:

@philipborbon
philipborbon / gist:a1ea020ebe70abe57673bc62b4c50d5c
Created November 27, 2019 00:50 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@philipborbon
philipborbon / Laravel-Scheduler-Windows.md
Created January 16, 2020 12:08 — forked from Splode/Laravel-Scheduler-Windows.md
Laravel Scheduler on Windows

Run Laravel Scheduled Tasks on Windows

The following are instructions for running scheduled tasks defined in a Laravel project on Windows. The Laravel documentation provides instructions for running scheduled tasks using cron jobs on Linux systems. However, cron jobs are not available on Windows. The built-in Windows Task Scheduler can be used to run scheduled tasks instead.

Create a Scheduled Task

  1. Open Task Scheduler
  2. Select Create Task...
  3. Give the task a name and description
  4. To run the task in the background, select Run whether the user is logged on or not and check the Hidden checkbox.
@philipborbon
philipborbon / perms.md
Created April 16, 2020 01:43 — forked from stefanbc/perms.md
Set proper permissions on /var/www/

HOWTO

To set up permissions on /var/www where your files are served from by default:

sudo addgroup webmasters
sudo adduser $USER webmasters
sudo chown -R root:webmasters /var/www
sudo find /var/www -type f -exec chmod 664 {} \;
sudo find /var/www -type d -exec chmod 775 {} \;