Skip to content

Instantly share code, notes, and snippets.

@MrMooky
MrMooky / AppServiceProvider.php
Created June 13, 2020 15:42 — forked from simonhamp/AppServiceProvider.php
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
use Illuminate\Support\Str;
/**
* Create a conversation slug.
*
* @param string $title
* @return string
*/
public function makeSlugFromTitle($title)
{
@MrMooky
MrMooky / slick-random.js
Created February 28, 2020 11:18 — forked from zexeder/slick-random.js
Slick Random Slides
$.fn.randomize = function (selector) {
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
$parents.each(function () {
$(this).children(selector).sort(function (childA, childB) {
// * Prevent last slide from being reordered
if($(childB).index() !== $(this).children(selector).length - 1) {
return Math.round(Math.random()) - 0.5;
}
# Force SSL and non-www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [R=301,L]
var gclid = getParameterByName('gclid');
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
billingFields['phone'].input.value.replace(/[\(\)\s\-]/g, ''), // remove (), spaces, and - from phone number
@MrMooky
MrMooky / .htaccess
Created August 22, 2019 06:51 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
{f:translate(key: 'LLL:EXT:siteway/Resources/Private/Language/locallang.xlf:career.gotquestions')}
[(request.getQueryParams()['tx_ext_ext'])['job'] > 0]
// DO SOMETHING ON DETAIL PAGE
[global]
plugin.metaseo.sitemap.index.blacklist {
10 = /(.*)\?(.*)/
20 = /jobs\/./
}