Skip to content

Instantly share code, notes, and snippets.

View yayMark's full-sized avatar
💾
Gettin ma tech awn

Mark Hewitt yayMark

💾
Gettin ma tech awn
  • Perth, Western Australia
View GitHub Profile
@yayMark
yayMark / ios_safari_no_input_shadow.css
Last active June 8, 2018 03:24
CSS: On Mobile Safari, remove shadow on an input field
/* Remove inner shadow from inputs on mobile iOS */
textarea,
input[type="text"] {
-webkit-appearance: none;
}
@yayMark
yayMark / wpgitrepo.sh
Created May 28, 2018 22:49
Linux shell, wp-cli, Valet: install WordPress, clone a theme from GitHub, remove plugins and themes, add to Valet, open site in browser
#!/bin/bash
# params
# 1 project folder
# 2 github user
# 3 github repo
cd ~/projects
mkdir $1
cd $1/
wp core download
cd wp-content/themes
@yayMark
yayMark / gist:a237ef21f8c84c5853745a1b404974a2
Created April 27, 2018 05:05
Use WordPress admin dashicons in your front end theme
Put this in functions.php:
wp_enqueue_style( 'dashicons-style', get_stylesheet_uri(), array('dashicons'), '1.0' );
Find what you want to use at https://developer.wordpress.org/resource/dashicons/
@yayMark
yayMark / click_outside.js
Created April 10, 2018 05:47
JavaScript/jQuery: Detect a click outside an element. Used for deactivating a drop down menu.
//detect click outside http://bassta.bg/2013/08/detect-click-event-outside-element/
var everything = jQuery(window);
var menuBody = jQuery(".menu-body");
var menu = jQuery(".menu");
var menuButtonClass = 'mobile-menu-button-img';
everything.on("click.yayMark", function (event) {
var menuButtonClicked = event.target.className == menuButtonClass;
if (menuBody.has(event.target).length == 0
&& !menuBody.is(event.target)
@yayMark
yayMark / find_delete.sh
Created April 6, 2018 22:03
Linux command line: Find files recursively, then delete them
find . -name .DS_Store
# find . -name .DS_Store -delete
@yayMark
yayMark / DebuggingSCSS.md
Created March 22, 2018 07:02
Debugging SCSS

If your SCSS rule isn't being applied, it's likely to be a mistake in the nesting of the rule.

  1. Check the CSS file for how the rule has been generated, e.g. .locations-listing .listings > ARTICLE .m-chapels .location-details
  2. Go to the HTML and copy the selector for where you're expecting it to be applied. This will be slightly different to how you've written. e.g. #main > section.locations-listing > div.wrapper.listings > article:nth-child(12) > div.location-details
  3. Comparing the examples, I see that .m-chapels is applied to the article element. It is not a descendent.
  4. Fix the rule in your SCSS, e.g. &.m-chapels .location-details instead of .m-chapels .location-details
  5. Profit!
@yayMark
yayMark / chevron.scss
Last active March 19, 2018 06:21
SCSS: chevrons for up, down, left, right... for whatever size and width you want
@mixin chevron-rules($chevron-size, $chevron-width) {
width: $chevron-size;
height: $chevron-size;
border-top-width: $chevron-width;
border-right-width: $chevron-width;
}
@mixin chevron-variant($chevron-size, $chevron-width, $variant:false) {
@if $variant {
&.#{$variant} {
@yayMark
yayMark / .bash_profile
Last active March 19, 2018 01:45
Mac OS command/terminal prompt with emoji
export PS1="\W 🦆 "
@yayMark
yayMark / spew.php
Created March 14, 2018 08:48
PHP: output a variable in JSON format
<?php
function spew($var) {
echo '<pre>';
echo json_encode($var, JSON_PRETTY_PRINT);
echo '</pre>';
}
[class*="layout-area-"] {
background-color: hotpink;
}
is the same as
.layout-area-1,
.layout-area-2,
.layout-area-3,
.layout-area-4,