Skip to content

Instantly share code, notes, and snippets.

View JulaineScott's full-sized avatar
🌲

Julaine Scott JulaineScott

🌲
View GitHub Profile
@JulaineScott
JulaineScott / doc_block.php
Created November 8, 2018 21:29 — forked from BaylorRae/doc_block.php
Parse PHP Doc Blocks
<?php
class DocBlock {
public $docblock,
$description = null,
$all_params = array();
/**
* Parses a docblock;
//bring in a dib with an id of part1 from another page:
$('#newArticle').load('inc/anotherPage.html #part1');
//simple ajax load of content (ie no post/get) from an external file
$('a[href="writeNew"]').click(function(e){ e.preventDefault(); $('#newArticle').load('inc/userWrite.php');});
//disable the button the moment it is clicked
//make sure to check also on server side
<input type="submit" value="Submit" onclick="this.disabled=true" />
style="filter: invert(.95) sepia(.95);"
@JulaineScott
JulaineScott / helpers.css
Created April 4, 2020 06:43
Lots of helpful CSS classes
.mt0{margin-top:0!important;}
.mt2{margin-top:2px!important;}
.mt5{margin-top:5px!important;}
.mt10{margin-top:10px!important;}
.mt15{margin-top:15px!important;}
.mt20{margin-top:20px!important;}
.mt25{margin-top:25px!important;}
.mt30{margin-top:30px!important;}
.mt35{margin-top:35px!important;}
.mt40{margin-top:40px!important;}
//@source https://codepen.io/joshwcomeau/pen/mdVZKwr
.drop-shadow {
filter: drop-shadow(2px 4px 8px hsla(0deg, 0%, 0%, 0.5))
}
@JulaineScott
JulaineScott / advent-calendar.css
Last active September 8, 2021 06:02
Advent Calendar CSS
/* ========= */
/* = Doors = */
/* ========= */
.doors {
margin: 4rem 0;
counter-reset: days;
}
.doors > li{
@JulaineScott
JulaineScott / advent-calendar.js
Created September 8, 2021 06:01
Advent Calendar JavaScript
var Utility = {
getPosition : function(el){
var oL = el.offsetLeft, oT = el.offsetTop;
var oE = el;
while(oE = oE.offsetParent){
oL = oL + oE.offsetLeft;
oT = oT + oE.offsetTop;
}
return [oL, oT];
},
@JulaineScott
JulaineScott / gist:f5faf1027a9e4125fdc65c02fe17c598
Created September 28, 2021 03:39
Form with stars as graphics
<div class="review-form-inner has-border">
<div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title">Add a review <small><a rel="nofollow" id="cancel-comment-reply-link" href="/blue-coma/#respond" style="display:none;">Cancel reply</a></small></h3><form action="https://deliverymeds.ca/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate="" enctype="multipart/form-data" encoding="multipart/form-data"><div class="comment-form-rating"><label for="rating">Your rating&nbsp;<span class="required">*</span></label><p class="stars"> <span> <a class="star-1" href="#">1</a> <a class="star-2" href="#">2</a> <a class="star-3" href="#">3</a> <a class="star-4" href="#">4</a> <a class="star-5" href="#">5</a> </span> </p><select name="rating" id="rating" required="" style="display: none;">
<option value="">Rate…</option>
<option value="5">Perfect</option>
<option value="4">Good</option>
@JulaineScott
JulaineScott / make-slugs
Created April 7, 2020 05:14
Change php files to slugs
#1)externally redirect "/file.php" to "/file"
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
#2)Internally map "/file" back to "/file.php"
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,L]