Skip to content

Instantly share code, notes, and snippets.

View DrewDouglass's full-sized avatar
🤠

Drew Douglass DrewDouglass

🤠
View GitHub Profile
@DrewDouglass
DrewDouglass / lockscreen.sh
Created August 25, 2016 15:58
Lock mac screen from command line
alias lockScreen='/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend';
@DrewDouglass
DrewDouglass / highlight.php
Created October 5, 2016 18:43
Highlight php var exports.
<?php echo highlight_string("<?php\n\$data =\n" . var_export($data, true) . ";\n?>"); ?>
@DrewDouglass
DrewDouglass / .htaccess
Created December 22, 2016 15:36
redirect http and www to https and non www.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
@DrewDouglass
DrewDouglass / console.js
Created January 19, 2017 15:07
Avoid console errors in browsers that have no console.
// Avoid `console` errors in browsers that lack a console.
if (!(window.console && console.log)) {
(function() {
var noop = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
var length = methods.length;
var console = window.console = {};
while (length--) {
console[methods[length]] = noop;
}
@DrewDouglass
DrewDouglass / handlebars.js
Created January 24, 2017 16:47
Handlebars basic function.
function templateLoad(templateName, dataSource, htmlNode, callback) {
var templateFile = 'partials/' + templateName + '.html';
jQuery.get(templateFile, function(template) {
var renderedTemplate = Handlebars.compile(template);
var result = renderedTemplate(dataSource);
//jQuery(htmlNode).replaceWith(result);
jQuery(htmlNode).append(result);
@DrewDouglass
DrewDouglass / this-is-silly.js
Created March 14, 2017 20:38
FullCalendar.js put date number at bottom right of cell.
//Fix for FullCalendar not having
//the most basic option of positioning
//the date number.
$(".fc-content-skeleton").each(function(index, el){
var $this = $(this);
var calHead = $this.find("thead").html();
$this.find("table").append("<tfoot>"+calHead+"</tfoot>");
});
@DrewDouglass
DrewDouglass / alternate.js
Created November 8, 2017 18:58
FullCalendar alternate calendar colors.
//Globla variable outside of all functions
var altColor = 1;
//Global function
function isEven(n) {
return n % 2 == 0;
}
//This goes inside the full calendar call
eventRender: function(event, element) {
if(isEven(altColor)) {
@DrewDouglass
DrewDouglass / gist:edae8ed762f7a4e65dbe3ebf257a9b81
Created June 8, 2018 17:31 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@DrewDouglass
DrewDouglass / responsive-videos.css
Created September 12, 2018 20:29
WordPress Responsive Videos
.vid {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.vid iframe,
.vid embed {
position: absolute;
top: 0;
@DrewDouglass
DrewDouglass / target-ie-11.css
Created September 12, 2018 21:13
Target IE10 and 11 with media query
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
// IE10+ CSS here
}