Skip to content

Instantly share code, notes, and snippets.

@markggn
markggn / replace.txt
Created September 26, 2019 06:04
Replace into...
public function replace($table, $data){
$q="REPLACE INTO `$table` ";
$v=''; $n='';
foreach($data as $key=>$val){
$n.="`$key`, ";
if(strtolower($val)=='null') $v.="NULL, ";
elseif(strtolower($val)=='now()') $v.="NOW(), ";
else $v.= "'".$this->escape($val)."', ";
}
// Apache
// Redirect AMP to non-AMP
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
//Nginx
if ($uri ~ "(.+)/amp(.*)$"){
set $rule_0 1$rule_0;
set $bref_1 $1;
@markggn
markggn / gctour.user.js
Created February 19, 2016 12:55 — forked from DieBatzen/gctour.user.js
GCTour
// ==UserScript==
// @name GC Tour
// @namespace madd.in
// @version 2.3
// @build 14271
// @description Cachetour planing made easy. Pick some Caches, sort the list and print it out. Free for all users of geocaching.com!
// @run-at document-end
// @include http*://www.geocaching.com/*
// @include http://gctour*.madd.in/map/show*#gui
// @exclude /^https?://www\.geocaching\.com/(login|about|articles)/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.