Skip to content

Instantly share code, notes, and snippets.

View manuelgeek's full-sized avatar
😎
#mANuEl💯

Magak Emmanuel manuelgeek

😎
#mANuEl💯
View GitHub Profile
@manuelgeek
manuelgeek / file
Created October 11, 2018 18:45
easyteather ubuntu 18.04
sudo easytether-usb
acquired interface tun-easytether
dropped root privileges
now CONNECTING
now CONNECTED
switching to background
manuelgeek@manuelgeek:~$ systemctl enable systemd-networkd
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /lib/systemd/system/systemd-networkd.socket.
@manuelgeek
manuelgeek / instructions.php
Last active August 16, 2018 21:18
Serverside datatables with Yajra in laravel yajra/laravel-datatables
Listing items in tables is one of the ,ost essential while building dashboards. Datatables https://datatables.net/ Add advanced interaction controls
to your HTML tables which we mostly do on the client side. Using the same approach to load large rows of data from the database
always becomes slow as the data grows bigger and bigger untl at some point the datatable break. This is a major reason to
consider using datatables from the start of your development to avoid such. Thats what we are goint to do.
Create a new laravel project composer create-project --prefer-dist laravel/laravel datatable-test
change the .env for database connections
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=datatables-test
@manuelgeek
manuelgeek / PhpFireBaseNotificationSample.php
Created August 8, 2018 06:17 — forked from MohammadaliMirhamed/PhpFireBaseNotificationSample.php
Simple PHP FireBase (FCM) script showing how to send an Android push notification. Be sure to replace the SERVER_API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call http://sample.com/PhpFireBaseNotificationSample.php?id=THE_DEVICE_REGISTRATION_ID The main Code For GCM is https://gist.github.com/prime…
<?php
#API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = $_GET['id'];
#prep the bundle
$msg = array
(
'body' => 'Body Of Notification',
/*
* Original script by: Shafiul Azam
* Version 4.0
* Modified by: Luigi Balzano
* Description:
* Inserts Countries and/or States as Dropdown List
* How to Use:
In Head section:
@manuelgeek
manuelgeek / ide-helper.php
Created July 20, 2018 19:39
ide-helper.php
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@manuelgeek
manuelgeek / \Illuminate\Session\TokenMismatchException
Created July 14, 2018 20:02
Token Mismach Exception Handling in Laravel
Replace your app\Exceptions\Handler.php render() function with this
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
@manuelgeek
manuelgeek / gist:09f2dcfc0e616fe360f0c30a8aaf96a1
Created July 6, 2018 16:35 — forked from jrmadsen67/gist:bd0f9ad0ef1ed6bb594e
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@manuelgeek
manuelgeek / MailChimpController.php
Last active February 13, 2019 23:32
a simple subscription code with Laravel 5.6 and MailChimp
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
use Config;
I was just watching a friend of mine work with git, and he'd always type all the git commands in full, like git status and git push. I realized that he must not be the only one to do so, so I decided to write this quick blog post and encourage everyone to create Huffman coded aliases for the most commonly used commands. Instead of typing git status, alias it to gs. Instead of git add, alias it to ga, etc.
Here are a bunch of aliases that I created for 99% of git commands I ever use:
alias ga='git add'
alias gp='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
@manuelgeek
manuelgeek / ext-mcrypt
Created June 14, 2018 07:01
add ext-mcrypt to php 7.2 ubuntu
https://lukasmestan.com/install-mcrypt-extension-in-php7-2/