Skip to content

Instantly share code, notes, and snippets.

Avatar

herblab googlebe

View GitHub Profile
@googlebe
googlebe / acf-future-posts.php
Created Dec 23, 2018 — forked from aderaaij/acf-future-posts.php
Advanced Custom Fields datepicker: Show only events with a date of today or in the future. Extra comments from Pasnon @ ACF Forums: f you needed to, you could also play with the comparison date, which is the first array in meta_query, currently set to date("Y-m-d") which is today; if you were to make it date("Y-m-d", strtotime("-1 day")) you cou…
View acf-future-posts.php
<?php
/*
* Display posts only from today and in the future:
* http://old.support.advancedcustomfields.com/discussion/6000/how-to-sort-posts-by-acf-date-and-display-only-future-posts
* by Pasnon
*/
$date_args = array(
'post_type' => 'events',
@googlebe
googlebe / ks-custom-login.js
Created May 13, 2018 — forked from konradsroka/ks-custom-login.js
Add Placeholders To WordPress Login Form And Remove Labels
View ks-custom-login.js
// ----------------------------------------------------
// Adding the placeholders in textfields of login form
// ----------------------------------------------------
jQuery(document).ready(function($) {
$('#loginform input[type="text"]').attr('placeholder', 'Username');
$('#loginform input[type="password"]').attr('placeholder', 'Password');
@googlebe
googlebe / change_dns.bat
Created Feb 22, 2018 — forked from maravedi/change_dns.bat
Batch Script to Change DNS Servers
View change_dns.bat
@ECHO OFF
ipconfig /all | findstr "Servers" | findstr "xx.xx.xx.xx"
if %ERRORLEVEL% equ 0 (
rem echo Findstr FOUND xx.xx.xx.xx in the DNS list.
goto google
) else (
rem echo Findstr DID NOT find xx.xx.xx.xx in the DNS list.
goto local
)
@googlebe
googlebe / ip.set.bat
Created Feb 22, 2018 — forked from moolex/ip.set.bat
Windows下自动设置IP的批处理脚本
View ip.set.bat
@echo off
::需要设置的网络,一般为“本地连接”或者“无线网络连接”
set name="无线网络连接"
::请根据您的参数修改以下数据
::设置 IP地址
set ipaddress=18.1.16.169
::设置 子掩码
set mask=255.255.252.0
::设置 网关
set gateway=18.1.19.254
@googlebe
googlebe / WP-HTML-Compression
Created Jan 6, 2018 — forked from sethbergman/WP-HTML-Compression
Minify HTML for WordPress without a Plugin - Add to function.php
View WP-HTML-Compression
<?php
class WP_HTML_Compression
{
// Settings
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
// Variables
@googlebe
googlebe / protect.conf
Created Jan 1, 2018 — forked from VirtuBox/protect.conf
Nginx Configuration to block SQL Injection and similar attacks
View protect.conf
location ~* "(eval\()" { deny all; }
location ~* "(127\.0\.0\.1)" { deny all; }
location ~* "([a-z0-9]{2000})" { deny all; }
location ~* "(javascript\:)(.*)(\;)" { deny all; }
location ~* "(base64_encode)(.*)(\()" { deny all; }
location ~* "(GLOBALS|REQUEST)(=|\[|%)" { deny all; }
location ~* "(<|%3C).*script.*(>|%3)" { deny all; }
location ~ "(\\|\.\.\.|\.\./|~|`|<|>|\|)" { deny all; }
location ~* "(boot\.ini|etc/passwd|self/environ)" { deny all; }
location ~* "(thumbs?(_editor|open)?|tim(thumb)?)\.php" { deny all; }
@googlebe
googlebe / validate.sh
Created Dec 11, 2017 — forked from hrwgc/validate.sh
bash wget - check if file exists at url before downloading
View validate.sh
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
}
@googlebe
googlebe / download_podcast.sh
Created Dec 11, 2017 — forked from bluvertigo/download_podcast.sh
bash wget - check if file exists at url before downloading
View download_podcast.sh
#!/bin/bash
# simple function to check http response code before downloading a remote file
# example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url () {
if [[ `curl -s --head "$1" | head -n 1 | grep "HTTP/[1-3].[0-9] [23].."` ]]
then
# 0 = true
@googlebe
googlebe / validate_url.sh
Created Dec 11, 2017 — forked from rbramwell/validate_url.sh
Validate URL using Bash cURL - Check if a resource exists at a URL
View validate_url.sh
#!/bin/bash
# Simple function to check http response code before downloading a remote file
# Example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url () {
if [[ `curl -s --head "$1" | head -n 1 | grep "HTTP/[1-3].[0-9] [23].."` ]]; then echo "true"; fi
}