Skip to content

Instantly share code, notes, and snippets.

View philipborbon's full-sized avatar

Philip Borbon philipborbon

View GitHub Profile
@philipborbon
philipborbon / Robots Environment .htaccess
Created April 16, 2020 03:46 — forked from chadclark/Robots Environment .htaccess
Robots.txt for Staging and Production. By adding these rewrite rules to your .htaccess file, robots_dev.txt will be served as robots.txt on any non-production server.
RewriteEngine On
# Robots.txt for Staging and Production -- change productiondomain.com to the actual url of your production site
RewriteCond %{HTTP_HOST} !productiondomain.com$ [NC]
RewriteRule ^robots.txt robots_dev.txt [L]
@philipborbon
philipborbon / httpd-vhosts.conf
Last active July 24, 2020 01:26
Sample Apache Virtual Host Configuration
<VirtualHost *:443>
DocumentRoot "path/to/public/directory"
ServerName domain.example.com
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<Directory "path/to/public/directory">
Options Indexes FollowSymLinks Includes ExecCGI
//
// BottomSheetView.swift
//
// Created by Majid Jabrayilov
// Copyright © 2019 Majid Jabrayilov. All rights reserved.
//
import SwiftUI
fileprivate enum Constants {
static let radius: CGFloat = 16

iOS Swift - Cancellable Task with GCD

#iOSBySheldon

I think most of you guys know GCD pretty well. Basically, GCD is a high level API to handle multi-threading operations. We use GCD almost on daily basis to switch thread and execute codes like:

DispatchQueue.main.async { //execute some codes here } 
//switch to main queue and execute codes asynchronously

DispatchQueue.main.sync { //execute some codes here } 
//switch to main queue and execute codes synchronously
//
// KitTextField.swift
//
// Created by philip@crescit.com on 10/6/20.
//
import SwiftUI
struct KitTextField: UIViewRepresentable {
let label: String
@philipborbon
philipborbon / Laravel Queue Cron Job.md
Last active December 7, 2020 06:56
Cron job command to execute Laravel queue on shared hosting

flock -xn /tmp/laravel_queues.lockfile -c "/usr/local/bin/php /home/user/www/project/artisan queue:work --sleep=3 --tries=3"

@philipborbon
philipborbon / MySQL Development Database Note
Created January 18, 2021 10:19
Exposing MySQL development database in local network
- Check `bind-address` in MySQL configuration
- Check database user if is allowed for any host (%) or specific to host trying to connect
- Check firewall if port is exposed
@philipborbon
philipborbon / git-deployment.md
Last active January 22, 2023 09:06 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@philipborbon
philipborbon / ios-font-sizes.swift
Created September 2, 2021 09:23 — forked from zacwest/ios-font-sizes.swift
iOS default font sizes - also available on https://www.iosfontsizes.com
let styles: [UIFont.TextStyle] = [
// iOS 11
.largeTitle,
// iOS 9
.title1, .title2, .title3, .callout,
// iOS 7
.headline, .subheadline, .body, .footnote, .caption1, .caption2,
]
for style in styles {
@philipborbon
philipborbon / post-receive [Laravel]
Last active January 22, 2023 09:08
Laravel production GIT post-receive
#!/bin/bash
TARGET="/home/user/project"
GIT_DIR="/home/user/project.git"
BRANCH="master"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ];
then