Skip to content

Instantly share code, notes, and snippets.

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;
# Force SSL and non-www
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [R=301,L]
@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;
}
use Illuminate\Support\Str;
/**
* Create a conversation slug.
*
* @param string $title
* @return string
*/
public function makeSlugFromTitle($title)
{
@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()
> Usage
$recipient = array('[email protected]');
$sender = array('[email protected]' => 'Account');
$subject = 'Hello there';
$templateName = "ThisIsTheExtbaseEmailTemplate"; // .html file
$content = array(
'firstname' => $postData['first_name']
);
> location.main
v1
location /blog/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2371;
$update = \Stripe\Subscription::update($subscriptionId, [
'billing_cycle_anchor' => 'now',
'proration_behavior' => 'always_invoice',
'proration_date' => strtotime('tomorrow 00:01'),
'default_tax_rates' => [$this->getCorrectTaxRateId($planID)],
'cancel_at_period_end' => false,
'items' => [
[
'id' => $subscription->items->data[0]->id,
'plan' => $planID
COMPOSER_MEMORY_LIMIT=-1 composer require author/package
<input type='tel' data-filter='[0-9|+]*' placeholder='123+456'>
<input type='tel' data-filter='(\+|(\+[1-9])?[0-9]*)' placeholder='+10123'>
<input type='text' data-filter='([A-Z]?|[A-Z][a-z]*)' placeholder='Abcdefg'>
<input type='text' data-filter='([A-Z]{0,3}|[A-Z]{3}[0-9]*)' placeholder='ABC123'>
---
// Apply filter to all inputs with data-filter:
let inputs = document.querySelectorAll('input[data-filter]');