This file contains 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
# Let apache know we're behind a SSL reverse proxy | |
SetEnvIf X-Forwarded-Proto "https" HTTPS=on | |
# Redirect to HTTPS | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC] | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IFModule> |
This file contains 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/bash | |
# Check if wp-cli is installed | |
command -v wp >/dev/null 2>&1 || { echo >&2 "wp-cli not found. Visit http://wp-cli.org for more details."; exit 1; } | |
# Show usage info if wrong argument count | |
if [ $# -ne 2 ]; then | |
printf "WordPress migration script\n\n" | |
printf "Usage:\n" | |
printf " migrate.sh <from url> <to url>\n\n" |
This file contains 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
--- Updated queries for a bedrock-setup which doesn't use the default path settings | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'href="https://your-domain.tld/app/uploads/', 'href="https://your-cdn-url.tld/'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'src="https://your-domain.tld/app/uploads/', 'src="https://your-cdn-url.tld/'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/'); | |
-- Plugins/Themes that use wp_options to store settings like logo file, etc. | |
UPDATE wp_options SET option_value = REPLACE(option_value, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/'); | |
--- VisualComposer custom CSS | |
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'https://your-domain.tld/app/uploads/', 'https://your-cdn-url.tld/') WHERE meta_key = '_wpb_shortcodes_custom_css'; |
This file contains 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
<!doctype html> | |
<html lang="de"> | |
<head> | |
<meta charset="utf-8"> | |
<title>CSS3 Accordion</title> | |
<style> | |
#accordion { | |
width: 810px; | |
height: 600px; | |
margin: 20px auto; |
This file contains 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
<?php | |
// Example class | |
class Hello | |
{ | |
// Just a simple function wich returns a string | |
public function World($name = 'World') | |
{ | |
return sprintf("Hello %s\n", $name); | |
} |
This file contains 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
#target photoshop | |
function sort_unique(arr) | |
{ | |
arr = arr.sort(); | |
var ret = [arr[0]]; | |
for (var i = 1; i < arr.length; i++) | |
{ | |
if (arr[i-1] !== arr[i]) { ret.push(arr[i]); } |
This file contains 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
<?php | |
// Optional | |
date_default_timezone_set('Europe/Berlin'); | |
// Set the date to tomorrow (midnight) | |
$tomorrow = new DateTime('tomorrow'); | |
// Print the result | |
print_r($tomorrow); |
This file contains 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
<?php | |
// Loop until the 20th binary digit of 0 | |
for ($bin = 1; $bin < 20; $bin++) | |
{ | |
// 1 has always one digit more than 0 | |
$bin_str = str_repeat('1', $bin +1) . str_repeat('0', $bin); | |
// Convert binary to decimal | |
$dec = bindec($bin_str); | |
This file contains 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
tell application "Mail" | |
using terms from application "Mail" | |
set theSelection to selection | |
set theMessage to first item of theSelection | |
set theBody to "message:%3C" & message id of theMessage & "%3E" | |
set theSubject to the subject of theMessage | |
tell application "Reminders" | |
set theList to first item of reminders | |
make new reminder with properties {name:theSubject, body:theBody, container:theList} | |
end tell |
This file contains 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
<? | |
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); |
NewerOlder