Skip to content

Instantly share code, notes, and snippets.

View felixivance's full-sized avatar
👻
Being Awesome

Felix Ivance felixivance

👻
Being Awesome
View GitHub Profile
@felixivance
felixivance / payeCalculator.php
Created October 11, 2023 19:46
KENYA PAYE CALCULATOR FORMULA IN PHP
public function calculatePayee($salaryAmount, $nssfAmount){
$tax = 0;
$remaining = $salaryAmount - $nssfAmount;
if($remaining > 24000){
$tax += 24000 * (10/100);
$remaining -= 24000;
if($remaining > 0){
$amountToTax = ($remaining < 8333) ? $remaining : 8333 ;
@felixivance
felixivance / app.Dockerfile
Created September 23, 2022 06:24
App Docker file Laravel setup
FROM php:7.4-fpm-alpine
RUN mkdir -p /var/www/html
WORKDIR /var/www/html
RUN sed -i "s/user = www-data/user = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i "s/group = www-data/group = root/g" /usr/local/etc/php-fpm.d/www.conf
RUN echo "php_admin_flag[log_errors] = on" >> /usr/local/etc/php-fpm.d/www.conf
@felixivance
felixivance / queue-worker.conf
Created November 11, 2020 11:17
Laravel-queue-worker Medium Article
sudo apt-get install supervisor
cd /etc/supervisor/conf.d
#edit file
sudo nano /etc/supervisor/conf.d/queue-worker.conf
#command
[program:queue-worker]
process_name=%(program_name)s_%(process_num)02d
@felixivance
felixivance / ShareUtils.java
Created October 13, 2018 14:59 — forked from Mariovc/ShareUtils.java
Utility to share text and url on Facebook, Twitter and Whatsapp
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@felixivance
felixivance / gist:ad70341a2e5534b08fe4387ba5e5a052
Created March 8, 2018 19:08 — 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>
@felixivance
felixivance / send-email-confirmation.service.ts
Created March 7, 2018 12:27
Angular Service send email confirmation
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/retry';
import 'rxjs/add/operator/toPromise';
import { environment } from '../../../environments/environment';
export const CLOUD_FUNCTION_URL = environment.firebase['cloudFunctionUrl'];
@Injectable()
@felixivance
felixivance / send-email-confirmation_index.js
Created March 7, 2018 12:26
Firebase Cloud Functions HTTP Trigger to send confirmation email utilizing SendGrid
'use strict';
const functions = require('firebase-functions');
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey("SEND_GRID_API_KEY"); /** replace with your own SendGrid API key */
const cors = require('cors')({
origin: ['ANGULAR_DEVELOPMENT_ENVIRONMENT_URL'], /** replace with the url of your development environment that serves your angular app. */