Skip to content

Instantly share code, notes, and snippets.

@Patabugen
Patabugen / jquery.wymeditor.alignment.js
Created January 16, 2012 04:15
WYM Plugin for adding text alignment (Center, Left, Right, Justify).
/*jslint evil: true */
/**
WYMeditor.alignment
====================
A plugin to add a class to a paragraph which can be used to set the alignment
for it.
Todo:
- Allow selection of which Alignment buttons to show
@Patabugen
Patabugen / jquery.wymeditor.site_links.js
Created January 16, 2012 04:19
WYMEditor Plugin to add a list of selectable links to the Link dialog box
@Patabugen
Patabugen / form_exporter.js
Created November 8, 2012 15:53
Form Exporter
/**
* This is a bit of code to make it easier to turn forms into PHP Arrays
* for use in scrapers etc.
* It's designed to be run from the console, e.g in Firebug. Just copy
* everything from this file into the console and hit Go. It shouldn't
* take much to turn it into a browser extension by someone with the know how.
**/
/**
* The arrays didn't seem to want to .concat, so I just call this
@Patabugen
Patabugen / clear-google-my-activity.js
Last active January 22, 2021 12:08
A little script to clear all your history at https://myactivity.google.com/myactivity
/**
* A little script to clear all your history at https://myactivity.google.com/myactivity
*
* Load Developer Console (usually F12), paste this into the Console and hit Enter (or Run).
*
* Doesn't use any cool magic, just simulates clicking on all the delete buttons.
**/
var ClearGoogleMyAccount =
{
@Patabugen
Patabugen / disable-wp-is-mobile.php
Last active June 23, 2022 15:35
Workaround for Simple Share Buttons and front end caching
<?php
/**
* The Simple Share Buttons uses wp_is_mobile() to decide how to render front end
* pages, which is incompatible with frontend caching. So filter the check
* to always return the "mobile version" (unless we are in the admin backend).
*
* Bbeware! It overrides _all_ frontend calls, not just SSBA ones).
*
* Save this as a mu-plugin ( wp-content/mu-plugins/disable-wp-is-mobile.php )
* or paste it into your functions.php file
@Patabugen
Patabugen / Transaction.php
Created June 28, 2022 18:26
Eloquent Model event hook to allow inserting primary keys into SQL Server tables with IDENTITY_INSERT = off
<?php
class Transaction extends Model
{
protected $primaryKey = 'TransactionID';
/**
* Using Laravel to export data from a SQL Server Express 15.0 I ran into an issue when creating test models
* using my Eloquent Model Factory on some tables which did not have an Auto Incrementing primary
* key, and where the table was set to disallow inserting the Primary Key (IDENTITY_INSERT is set to OFF).
*
@Patabugen
Patabugen / MakeEntryLine.php
Last active July 26, 2022 16:06
Default shouldRun expectations in Laravel Actions
<?php
/**
* An example of overriding the shouldRun method to add the default expectations to the Mock,
* instead of redefining it in all your tests.
*
* You can still call MakeEntryLine::shouldRun()->andReturn(...)
* to override the default expectations.
*/
namespace App\Actions\Csv;
@Patabugen
Patabugen / 1-DuskServiceProvider.php
Last active July 27, 2022 14:42
Laravel Dusk "waitForAjax" Macro (and an old CodeCeption one)
<?php
/**
* $browser->waitForAjax() macro for Laravel Dusk. See comment below for details.
**/
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\Browser;
class DuskServiceProvider extends ServiceProvider
@Patabugen
Patabugen / StrServiceProvider.php
Created August 2, 2022 17:18
isMatch macro for Laravel fluent strings to check if a string matches a regex
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\Support\Stringable;
/**
* Add isMatch() method to Str helper and Stringable objects. isMatch is the love hild
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://app.sunsama.com/*focus=true*
// @que
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none