View dnd.sh
#!/bin/bash | |
# https://apple.stackexchange.com/a/303400 | |
set -eou pipefail | |
# From https://heyfocus.com/enabling-do-not-disturb-mode and | |
# https://apple.stackexchange.com/questions/145487 | |
if [[ $(defaults -currentHost read ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb) -eq 0 ]]; then |
View s3.sh
# Can also use --dryrun instead of --recursive to see what would have happened. | |
aws s3 cp s3://yourbucket/theoneyouwant/ ~/Desktop/bucket-backup --recursive |
View s3_client.py
""" | |
The server application uses AWS S3 in various places. | |
This utility provides a common place for interacting | |
with S3 and handles the authentication in a unified manner. | |
""" | |
import os.path | |
import logging |
View search_custom_columns.php
<?php | |
function cf_search_join( $join ) { | |
global $wpdb; | |
if ( is_search() ) { | |
$join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id '; | |
} | |
return $join; | |
} |
View getParams.js
var getUrlParameter = function getUrlParameter(sParam) { | |
var sPageURL = window.location.search.substring(1), | |
sURLVariables = sPageURL.split('&'), | |
sParameterName, | |
i; | |
for (i = 0; i < sURLVariables.length; i++) { | |
sParameterName = sURLVariables[i].split('='); | |
if (sParameterName[0] === sParam) { |
View findFonts.sh
strings ~/Desktop/filename.pdf | grep FontName |
View workaround-js.html
<!-- Assumes jQuery is loaded which is almost always the case --> | |
<img src="/your/image.jpg" alt="Logo" onload="$.getScript('https://yoursite.com/main.js');"> |
View scroll.js
$("a[href='#top']").click(function() { | |
$("html, body").animate({ scrollTop: 0 }, "slow"); //Can replace with milliseconds | |
return false; | |
}); |
View .htaccess
RewriteCond %{HTTP_HOST} !https://domainnamehere.org$ [NC] | |
RewriteRule ^(.*)$ https:// domainnamehere.org/$1 [R=301,L] |
View target-ie-11.css
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { | |
// IE10+ CSS here | |
} |
NewerOlder