Skip to content

Instantly share code, notes, and snippets.

View isaactopo's full-sized avatar
💻
Learning…

isaac isaactopo

💻
Learning…
View GitHub Profile
@isaactopo
isaactopo / submitFormAJAX.js
Last active May 25, 2022 16:40
AJAX Form Submit
(function () {
'use strict'
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.querySelectorAll('.needs-validation')
// Loop over them and prevent submission
Array.prototype.slice.call(forms)
.forEach(function (form) {
form.addEventListener('submit', function (event) {
event.preventDefault()
event.stopPropagation()
@isaactopo
isaactopo / regex-author-example
Last active February 9, 2022 10:24
Regex Author example
https://regex-generator.olafneumann.org/?sampleText=user%3A%20a-minero&flags=i&onlyPatterns=true&matchWholeLine=false&selection=0%7CMultiple%20characters,4%7CCharacter,5%7COne%20whitespace,6%7COne%20character,7%7CCharacter,8%7CMultiple%20characters
Find: Author+:\s([a-zA-Z])-([a-zA-Z]+)
Replace: Author: $1.$2@baylos.com
@isaactopo
isaactopo / fake-content.php
Last active January 19, 2022 10:43
Echo Fake images and titles randomly in PHP
<?php
$concepts = [
'https://images.unsplash.com/photo-1450897918656-527057db59d3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8MjExfHx8ZW58MHx8fHw%3D&auto=format&fit=crop&w=800&h=400&q=60',
'https://images.unsplash.com/photo-1515606378517-3451a4fa2e12?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=800&h=400&q=80',
'https://images.unsplash.com/photo-1596171810878-888894ed5b8f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=800&h=400&q=80',
'https://images.unsplash.com/photo-1560771913-2d303774f0fa?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=800&h=400&q=80',
'https://images.unsplash.com/photo-1605597574993-342d8dbb8a7a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=800&h=400&q=80',
];
$texts = [
@isaactopo
isaactopo / md-to-kirby-blocks.php
Last active February 28, 2023 16:07
Convert Markdown Posts to Kirby Blocks
<?php
// Converting Markdown posts to Kirby Blocks
// Useful for K2 to K3 content Migrations
// Or if you want to transform automatically your Markdown to Kirby Blocks
// Get posts
$posts = $page->children()->listed();
foreach ($posts as $post) {
@isaactopo
isaactopo / Delete-Twitter-Ads-with-CSS.css
Last active August 11, 2020 15:12
Get Stylish extension or another one that helps you add CSS on your visited pages and add this ↓
div[data-testid="placementTracking"] article {
display:none;
}
@isaactopo
isaactopo / settings.json
Last active October 20, 2020 16:27
VSCode PHP & Kirby Snippets
{
"K:Snippet": {
"scope": "php,html",
"prefix": "sn",
"body": [
"<?php snippet('${1|header,footer,cta|}') ?>"
],
"description": "Create Kirby Snippet"
},
"Open PHP": {
@isaactopo
isaactopo / Nationalities.en.json
Last active May 9, 2020 08:11
Nationalities in JSON format (EN)
{
"Countries": [{
"country": "Afghanistan",
"noun": "Afghan(s)",
"adj": "Afghan",
"alpha-2": "AF",
"alpha-3": "AFG",
"country-code": 4
},
{
@isaactopo
isaactopo / Country list in JSON format
Last active May 9, 2020 08:05
Countries list in JSON format
{
"Countries": [{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@isaactopo
isaactopo / read-write-kirby.php
Last active August 29, 2015 14:24
Read and Write a Kirby text File Data.
<?php
// Read the Kirby Data from the page Text File 'kd'
$doc = data::read($page->textfile(), 'kd');
// Add or modify the entries
$doc['Text'] = 'Lorem ipsum dolor…';
$doc['Likes'] = 22;
// Write the Text File with the new data
@isaactopo
isaactopo / yaml.less
Last active August 29, 2015 14:13
YAML syntax for no-caffeine-syntax for Atom Editor
// ---------------------------------------------------------------------------
// Languages: Yaml
// ---------------------------------------------------------------------------
.source.yaml{
// Yaml: %key
.tag.yaml { color: @color-brown_light; }
// Yaml: %value - string
.string.quoted.single{ color: @color-green; }