Skip to content

Instantly share code, notes, and snippets.

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

Magak Emmanuel manuelgeek

😎
#mANuEl💯
View GitHub Profile
@MohammadaliMirhamed
MohammadaliMirhamed / PhpFireBaseNotificationSample.php
Last active December 28, 2024 22:56
This repository showcases a simple and effective script to send push notifications to Android devices using Firebase Cloud Messaging (FCM). Designed for developers, the code provides a quick setup for integrating FCM notifications with minimal configuration.
<?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',
@SergeyMiracle
SergeyMiracle / nginx_auto_start.sh
Created January 13, 2017 04:42 — forked from aymanosman/nginx_auto_start.sh
Nginx: Start nginx on boot on Mac
# brew install nginx
sudo ln -s /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/
sudo chown root:wheel /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
# Why do you need sudo?
# If you want nginx to be able to bind to port 80, it will need superuser privileges
@dmongeau
dmongeau / .travis.yml
Last active April 27, 2022 10:16
Example of travis configuration for Laravel Package testing (5.1 to 5.8) on multiple versions of PHP (5.5 to 7.3) with code coverage (coveralls)
language: php
cache:
directories:
- $HOME/.cache/pip
- $HOME/.composer/cache/files
php:
- 5.6
- 7.0
@fgilio
fgilio / axios-catch-error.js
Last active February 27, 2025 05:50
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@singledigit
singledigit / cognito.yaml
Last active December 11, 2024 10:03
Create a Cognito Authentication Backend via CloudFormation
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Parameters:
AuthName:
Type: String
Description: Unique Auth Name for Cognito Resources
Resources:
# Creates a role that allows Cognito to send SNS messages
SNSRole:
@manuelgeek
manuelgeek / call back json
Created December 21, 2017 07:18
Mpesa Call Back Json pattern and saving
{
"Body": {
"stkCallback": {
"MerchantRequestID": "8948-2950929-465",
"CheckoutRequestID": "ws_CO_251120171533239788",
"ResultCode": 0,
"ResultDesc": "The service request is processed successfully.",
"CallbackMetadata": {
"Item": [
{
@abel-masila
abel-masila / AppServiceProvider.php
Created February 7, 2018 15:57
yntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}
public class Student
{
public Guid Id { get; set; }
public string Name { get; set; }
public int Marks { get; set; }
}
///////
public class StudentCrud
public class TestController : ApiController
{
[HttpGet]
public IEnumerable<Student> Students()
{
return StudentCrud.GetStudents();
}
}
@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;