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 / mix_format_script.sh
Created August 18, 2021 13:36 — forked from bahodge/mix_format_script.sh
Find or Create .formatter.exs script that makes one in the current directory
#!/bin/sh
current=$(pwd)
formatter_file=".formatter.exs"
echo $current
if [ -e $current/"$formatter_file" ];
then
mix format
echo "Formatting Complete"
<x-layout>
<x-section>
<x-tabs active="First">
<x-tab name="First">
First content goes here.
</x-tab>
<x-tab name="Second">
Second content goes here.
</x-tab>
@manuelgeek
manuelgeek / index.js
Created April 16, 2021 09:20 — forked from acfatah/index.js
Quasar Vue Router Middleware Pipeline Example
// router/index.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import middlewarePipeline from './middleware-pipeline'
Vue.use(VueRouter)
@manuelgeek
manuelgeek / example.ex
Created July 30, 2020 18:08 — forked from ck3g/example.ex
How to read from STDIN in Elixir (for HackerRank)
defmodule Solution do
#Enter your code here. Read input from STDIN. Print output to STDOUT
end
array_length = IO.read(:stdio, :line)
array = IO.read(:stdio, :line)
array_length
|> String.trim
|> String.to_integer
@manuelgeek
manuelgeek / config.exs
Created March 25, 2020 13:56 — forked from nimish-mehta/config.exs
Configure Logging to File in Phoenix
# Configures Elixir's Logger to log to file
# ensure https://github.com/onkel-dirtus/logger_file_backend
# is installed in deps of the project in mix.exs
# reuses the original phoenix logging format.
config :logger, backends: [{LoggerFileBackend, :request_log}],
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Keep a seperate log file for each env.
# logs are stored in the root directory of the application
@manuelgeek
manuelgeek / axios-catch-error.js
Created August 2, 2019 09:01 — forked from fgilio/axios-catch-error.js
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 😨
@manuelgeek
manuelgeek / README-Template.md
Created April 30, 2019 09:33 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@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 / 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