Skip to content

Instantly share code, notes, and snippets.

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

William Mandai wmandai

🏠
Working from home
View GitHub Profile
@wmandai
wmandai / Codeigniter IIS web.config
Last active August 11, 2023 06:24
IIS web.config for codeigniter
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Index">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@wmandai
wmandai / AppServiceProvider.php
Created June 23, 2021 21:21 — forked from greenspace10/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
});
@wmandai
wmandai / Controllers--Livewire--Chat.php
Created June 23, 2021 21:40 — forked from developerdza/Controllers--Livewire--Chat.php
Real Time Chat By Laravel And Livewire
<?php
namespace App\Http\Livewire\Forum;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Livewire\WithPagination;
use Livewire\Component;
use App\Message;
use App\User;
class Chat extends Component
@wmandai
wmandai / codeigniter-csrf
Created January 4, 2014 12:15
Codeigniter disable CSRF in specific pages
<?php
// Add this to your config.php file
if (stripos($_SERVER["REQUEST_URI"],'/controller/method') === FALSE) {
$config['csrf_protection'] = TRUE;
}else{
$config['csrf_protection'] = FALSE;
}
//the rest of the code

Keybase proof

I hereby claim:

  • I am wmandai on github.
  • I am wmandai (https://keybase.io/wmandai) on keybase.
  • I have a public key ASAB1ir5HXMjIN3rypTZhK04H4XR1Aedjf5scfoVUew4jQo

To claim this, I am signing this object:

@wmandai
wmandai / Configurations for Laravel app on Kubernetes - Dockerfile Deploying laravel on kubernetes cluster - Ready to use configuration Files
FROM php:7.2-fpm
COPY app /var/www/
EXPOSE 9000
@wmandai
wmandai / 5ec3395c86134.php
Created June 23, 2021 21:27 — forked from owenconti/5ec3395c86134.php
Building a search drop down component with Laravel Livewire
<?php
namespace App\Http\Livewire;
use App\Contact;
use Livewire\Component;
class ContactSearchBar extends Component
{
public $query;
@wmandai
wmandai / Download.php
Created June 23, 2021 21:26 — forked from nkeena/Download.php
Download a file using Laravel Livewire
<?php
use Livewire\Component;
class Download extends Component
{
public function download()
{
// get the path to the file
$path = "";
<?php
//check for referal links
function referal()
{
$CI =& get_instance();
$cookie_value_set = $CI->input->cookie('_tm_ref', TRUE) ? $CI->input->cookie('_tm_ref', TRUE) : '';
if ($CI->input->get('ref', TRUE) AND $cookie_value_set == '') {
// referred user so set cookie to ref=username
$cookie = array(
'name' => 'ref',
Filename: /etc/apache2/sites-available/yoursite.conf
<VirtualHost *:80>
ServerAdmin youremail@yahoo.com
ServerName yoursite.com
ServerAlias www.yoursite.com
DocumentRoot "/var/www/yoursite.com/public"
<Directory /var/www/yoursite.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All