Skip to content

Instantly share code, notes, and snippets.

View molovo's full-sized avatar
🏠
Working from home

James Dinsdale molovo

🏠
Working from home
View GitHub Profile
diff --git a/cli/stubs/etc-phpfpm-valet.conf b/cli/stubs/etc-phpfpm-valet.conf
index 76c4ac7..85c175d 100644
--- a/cli/stubs/etc-phpfpm-valet.conf
+++ b/cli/stubs/etc-phpfpm-valet.conf
@@ -9,7 +9,7 @@ listen.group = staff
listen.mode = 0777
-php_admin_value[memory_limit] = 128M
+php_admin_value[memory_limit] = 2G
@molovo
molovo / valet-listen-address.patch
Created December 13, 2019 15:26
A composer patch to allow valet to listen on an external IP address
diff --git a/cli/stubs/secure.valet.conf b/cli/stubs/secure.valet.conf
index f35c989..376e84a 100644
--- a/cli/stubs/secure.valet.conf
+++ b/cli/stubs/secure.valet.conf
@@ -1,11 +1,11 @@
server {
- listen 127.0.0.1:80;
+ listen 80;
server_name VALET_SITE www.VALET_SITE *.VALET_SITE;
return 301 https://$host$request_uri;
@molovo
molovo / Wysiwyg.php
Created December 10, 2018 14:58
Wysiwyg block for Magento 2 widgets
<?php
namespace <vendor>\<module>\Block\Adminhtml\Widget;
use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Form\Element;
use Magento\Cms\Model\Wysiwyg\Config;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Factory;

Keybase proof

I hereby claim:

  • I am molovo on github.
  • I am molovo (https://keybase.io/molovo) on keybase.
  • I have a public key ASCR10KV__E4jv8vHvRJCRz_fnerGVmSWryJF4rDjE0mWQo

To claim this, I am signing this object:

@molovo
molovo / title_changing_stuff.js
Last active February 28, 2016 08:52
Quick bit of JS to change page title when the user navigates away from the tab
( function () {
// This function does the dirty work of finding the event type and setting the appropriate title
var updatePageTitle = function ( evt ) {
var v = "This text should match your <title> element", // The title when tab is visible
h = "I Miss You! ❤", // The title when tab is hidden
evtMap = {
focus: v,
focusin: v,
pageshow: v,
@molovo
molovo / Default (OSX).sublime-keymap
Created March 18, 2014 14:47
My SublimeText2 User Settings File
[
// swap the keybindings for paste and paste_and_indent
{
"keys": [ "super+v" ],
"command": "paste_and_indent"
}, {
"keys": [ "super+shift+v" ],
"command": "paste"
},
@molovo
molovo / gist:6907965
Last active September 16, 2019 03:47
A short snippet for exporting posts from Anchor CMS into separate .markdown files for use with Jekyll. Just add the created files straight into your _posts folder in jekyll. The following code goes into /anchor/routes/site.php, then just visit <site URL>/export to create the files
Route::get('export', function() {
$posts = Post::where('status', '=', 'published')->get();
foreach ($posts as $post) {
$content = <<<EOD
---
layout: post
title: "$post->title"
date: $post->created
categories: blog
@molovo
molovo / anchor.sublime-snippet
Created October 9, 2013 10:37
A small sublime snippet set for anchor CMS. Save the file in /Users/<username>/Library/Application Support/Sublime Text 2/Packages/User. Tweet @molovo for further requests :)
<snippet>
<content><![CDATA[
<?php if(has_posts()): ?>
<ul>
<?php while(posts()): ?>
<li>
<article>
<h1>
<a href="<?php echo article_url(); ?>" title="<?php echo article_title(); ?>">
<?php echo article_title(); ?>
@molovo
molovo / gist:5514490
Created May 3, 2013 21:51
A simple AJAX download counter. Count is stored in a json file, and updated via PHP.
// jQuery to update counter when button is clicked
$('#download').click(function(event) {
event.preventDefault();
var redirectUrl = $(this).attr('href');
$.ajax({
url: "downloads.php",
success: function(response) {
if (response = 'success') {
// The counter file has been updated in the background, but we should update the results on screen to tell the user
var count = $('#count').html();
@molovo
molovo / gist:5330415
Created April 7, 2013 13:02
Some yummy jQuery date validation. Was designed to allow a standard text input to accept date values, which could then be recognised by a datepicker widget which is only able to recognise inputted values in dd/mm/yyyy format. Could also be used to simply allow the user to use their preferred format, but still have consistency within the database…
$('input.class').blur(function() {
// First grab the date entered
var enteredDate = $(this).val();
// If enteredDate is only a number, add slashes at the correct points
if ( enteredDate == parseFloat(enteredDate) ) {
enteredDate = enteredDate.replace(/(\S{2})/g,"$1/");
enteredDate = enteredDate.replace(/\/$/,""); // removes the final slash
//alert (enteredDate);
}