This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
function get_ssl_domain_expiration($ssl_domain){ | |
$i = 0; | |
$ssl_domain_data = array(); | |
$domain = parse_url($ssl_domain, PHP_URL_HOST); | |
$g = stream_context_create (array("ssl" => array("capture_peer_cert" => true))); | |
$r = stream_socket_client("ssl://${domain}:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $g); | |
$cert = stream_context_get_params($r); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Block WordPress xmlrpc.php requests | |
<Files xmlrpc.php> | |
order deny,allow | |
deny from all | |
</Files> | |
# END protect xmlrpc.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Standalone command | |
sed -i 's/old string/new string/g' /home/dude/text-file.txt | |
## use a custom separator | |
sed -i 's:old/folder/path:new/folder/path:g' /home/dude/text-file.txt | |
## dry run | |
sed 's/old string/new string/g' | less |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------------------------- | |
// Method #1 | |
var sum = [1, 2, 3].reduce(add, 0); | |
function add(a, b) { | |
return a + b; | |
} | |
console.log(sum); // 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://adripofjavascript.com/blog/drips/boiling-down-arrays-with-array-reduce.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// =========================================================== | |
// Simple toggle | |
// ---------------------------------- | |
var bool = true; | |
bool = !bool; | |
// =========================================================== | |
// Function to toggle | |
// ---------------------------------- | |
$scope.form_state.showing = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.row.row-eq-height(ng-repeat='product in productsFiltered=(products | filter:{name: filterQuery} | orderBy: sortTerm)' ng-if='$index % 3 == 0') | |
.col-xs-4(ng-repeat='i in [0, 1, 2]', ng-init='product = productsFiltered[$parent.$parent.$index + i]', ng-if='$parent.$index + i < productsFiltered.length') | |
.panel.b.product-list-block.mb-sm | |
.panel-heading | |
span.product-type-icon | |
div {{product.name}} | |
table.product-list-block-table.mt-lg.mb-lg | |
tbody | |
tr | |
th Price |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
filepath="test.txt" | |
added_date__year_month_day=$(mdls -name kMDItemFSName -name kMDItemDateAdded -raw "$filepath" | awk '{print $1}') | |
echo $added_date__year_month_day | |
#2017-12-10 | |
added_date__year_month=$(mdls -name kMDItemFSName -name kMDItemDateAdded -raw "$filepath" | awk '{print $1}' | cut -c1-7) | |
echo $added_date__year_month | |
# 2017-12 |