View caldera-core.php
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
add_action( 'init', 'handle_preflight' ); | |
function handle_preflight() { | |
// Set the domain that's allowed to make the API call. | |
header("Access-Control-Allow-Origin: " . get_http_origin()); | |
// Set the methods | |
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE"); | |
header("Access-Control-Allow-Headers: Origin, Content-Type, Accept"); | |
if ( 'OPTIONS' == $_SERVER['REQUEST_METHOD'] ) { |
View .htaccess
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
<ifmodule mod_headers.c=""> | |
SetEnvIf Origin "^(.*\.alpes\.ch)$" ORIGIN_SUB_DOMAIN=$1 | |
Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN | |
Header set Access-Control-Allow-Methods: "*" | |
Header set Access-Control-Allow-Headers: "Origin, X-Requested-With, Content-Type, Accept, Authorization" | |
</ifmodule> |
View gist:db22cb2a4ef621511fe38224bf18c591
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
https://www.zuerioberland-tourismus.ch/de/kontakt-service/veranstaltungskalender?id=588548364 | |
https://www.zuerioberland-tourismus.ch/de/kontakt-service/veranstaltungskalender/event-588548364 |
View compareTables.sql
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
SELECT table1.ID | |
FROM table1 | |
LEFT OUTER JOIN table2 ON table1.ID = table2.ID | |
WHERE table2.ID IS NULL |
View urls.sh
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
for i in `cat testurls.txt` | |
do | |
curl -v -o /dev/null $i\&lorem=$RANDOM | |
done | |
# testurls.txt simply lists one URL per line |
View gist:768ac1e177e4b1ca3879
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
svn st | grep '^?' | awk '{print $2}' | xargs rm -rf |
View tag_regex
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
<.*?(\>) |
View split_string.sql
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
DROP procedure IF EXISTS split_string; | |
DELIMITER $$ | |
CREATE PROCEDURE split_string (list TEXT) | |
BEGIN | |
DECLARE max INT DEFAULT 0; | |
DECLARE i INT DEFAULT 1; | |
DECLARE elem INT DEFAULT 0; | |
SET max = length(list) - length(replace(list, ',', '')); |
View autoincrement.sql
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
ALTER TABLE tbl AUTO_INCREMENT = 5; |
NewerOlder