Skip to content

Instantly share code, notes, and snippets.

View grim-reapper's full-sized avatar

Imran Ali grim-reapper

View GitHub Profile
@cinkagan
cinkagan / XSS.php
Created January 11, 2021 23:41
Laravel Query String Xss Security Middleware
<?php
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Redirect;
use Closure;
class XSS
{
/**
@echr
echr / app.js
Last active November 23, 2023 12:05
Simple Laravel + Vue + Laravel Mix + Firebase Notification (PWA, Offline)
// FILE PATH: /resources/js/app.js
require('./bootstrap');
// Import Service Worker Registry
require('./extensions/sw-registry');
import Vue from 'vue';
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MediaCapture and Streams API</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
@malikbilal1997
malikbilal1997 / Pakistan Cities List.html
Last active July 25, 2024 11:27
List of All Pakistan Cities Html Code.
<select name="Location" id="Location" required>
<option value="" disabled selected>Select The City</option>
<option value="Islamabad">Islamabad</option>
<option value="" disabled>Punjab Cities</option>
<option value="Ahmed Nager Chatha">Ahmed Nager Chatha</option>
<option value="Ahmadpur East">Ahmadpur East</option>
<option value="Ali Khan Abad">Ali Khan Abad</option>
<option value="Alipur">Alipur</option>
<option value="Arifwala">Arifwala</option>
<option value="Attock">Attock</option>
@grim-reapper
grim-reapper / slugify.php
Created March 1, 2018 10:35 — forked from james2doyle/slugify.php
Simple slugify function for PHP. Creates a slug for the passed string, taking into account international characters as well.
<?php
function slugify($string, $replace = array(), $delimiter = '-') {
// https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Utils/Slug.php
if (!extension_loaded('iconv')) {
throw new Exception('iconv module not loaded');
}
// Save the old locale and set the new locale to UTF-8
$oldLocale = setlocale(LC_ALL, '0');
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
@tpaksu
tpaksu / renew.sh
Created January 19, 2018 07:35
laragon refresh certificates
#!/bin/sh
CRTPATH=$(pwd -W)
for i in *.key ; do
DOMAIN=${i%.key}
cat << EOF > openssl_$DOMAIN.conf
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
@fians
fians / optimize.php
Created January 3, 2018 10:24
Optimize Image in PHP using Imagick according Google Pagespeed Recommendation
/**
* Optimize image image
*
* https://developers.google.com/speed/docs/insights/OptimizeImages
* -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB
*
* @access public
* @param string $filePath Path of the file
* @return string Raw image result from the process
*/
@jeffochoa
jeffochoa / Response.php
Last active November 13, 2024 14:18
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@foobear
foobear / copy-element-text-bookmarklet.js
Last active May 26, 2023 20:51
JavaScript bookmarklet to click an element and copy its text contents. See https://makandracards.com/makandra/46962
(function() {
var overlay = document.createElement('div');
Object.assign(overlay.style, {
position: 'fixed',
top: 0,
left: 0,
width: '100vw',
height: '100vh',
zIndex: 99999999,
background: 'transparent',