Skip to content

Instantly share code, notes, and snippets.

View mikemartin's full-sized avatar

Mike Martin mikemartin

View GitHub Profile
@mikemartin
mikemartin / MigrateUsersToDatabase.php
Last active April 29, 2022 17:59
Migrate flat-file users to Eloquent.
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use SplFileInfo;
use Statamic\Facades\YAML;
title: Little Bard
fields:
-
handle: text
field:
sets:
button:
display: Button
fields:
-
@mikemartin
mikemartin / _seo.antlers.html
Last active January 6, 2022 19:27
SEO Basic
{{ if seo_title == 'custom' }}
<title>{{ custom_title }}</title>
<meta name="twitter:title" content="{{ custom_title }}" />
<meta property="og:title" content="{{ custom_title }}" />
{{ else }}
<title>{{ title }} // {{ site:name }}</title>
<meta name="twitter:title" content="{{ title }}" />
<meta property="og:title" content="{{ title }}" />
{{ /if }}
@mikemartin
mikemartin / gist:a2266dbff16041c93cf9aa540a6a8465
Created December 5, 2018 23:27
Delete Spammy markdown files
grep -Ril “@mail.ru” . | xargs rm
grep -Ril “hot girls” . | xargs rm
grep -Ril "д" . | xargs rm
@mikemartin
mikemartin / statamic-ajax.js
Last active March 28, 2017 21:05
submit statamic form with ajax
$(function() {
$.ajaxSetup({
headers: { 'X-CSRF-TOKEN': $('input[name="_token"]').val() }
});
var form = $('.contact-form');
form.submit(function(e) {
e.preventDefault();
{{ if {bison:cart_discount} }}
<tr>
<th colspan="4">Discount:</th>
<td class="numeric">-${{ bison:cart_discount }}</td>
</tr>
{{ endif }}
<tr>
<th colspan="4">Total:</th>
<td class="numeric"><h3>${{ bison:cart_total }}</h3></strong></td>
</tr>
@mikemartin
mikemartin / gist:2c06766c0633e56124f4
Created July 18, 2014 17:47
How to flip the Bourbon Refills Side Image pattern
.side-image {
@include media($large-screen) {
@include row(table);
&.image-flipped {
direction: rtl;
.content {
direction: ltr;
}
}
@mikemartin
mikemartin / gist:e709bfade202231a2f93
Created July 18, 2014 17:44
Remove line breaks on small screens
br {
display: none;
@include media($large-screen) {
display: block;
}
}
@mikemartin
mikemartin / gist:7881062
Created December 9, 2013 21:17
CSScomb Sort Order - Default
{
"custom_sort_order": false,
"sort_order": [
"position",
"top",
"right",
"bottom",
"left",
"z-index",
"display",
@mikemartin
mikemartin / gist:7796738
Created December 4, 2013 22:26
Block grid LESS mixin
/* Block Grids
========================================================================== */
.block-grid-2 { .block-grid(2); }
.block-grid-3 { .block-grid(3); }
.block-grid-4 { .block-grid(4); }
.block-grid-5 { .block-grid(5); }
.block-grid-6 { .block-grid(6); }
.block-grid-7 { .block-grid(7); }
/* Block Grids Mixins