Skip to content

Instantly share code, notes, and snippets.


Chris Macagare

  • Germany
View GitHub Profile
Macagare / gist:3999321
Last active Nov 15, 2020
Coldfusion: create timestamp
View gist:3999321
<cfset timestamp = dateDiff( 's', createDate(1970,1,1), now() ) />
Macagare / gist:4603792
Last active Oct 18, 2019
Coldfusion: strip tags from html
View gist:4603792
<!--- strip tags --->
<cfset stripedString = ReReplaceNoCase(source,"<[^>]*>","","ALL") />
Macagare / gist:4134400
Last active Apr 22, 2019
Javascript: Google Analytics Snipper + Google Analytics JS Logging
View gist:4134400
var _gaq = _gaq || [['_setAccount', 'UA-xxxxxxx-1'], ['_trackPageview']];
; (function ($, n, d, t, w, s, undefined) {
//Google Analytics Snipper
var g = d.createElement(t); g.type = 'text/javascript'; g.async = true;
g.src = ('https:' == d.location.protocol ? 'https://ssl' : 'http://www') + '';
var b = d.getElementsByTagName(t)[0]; b.parentNode.insertBefore(g, b);
Macagare / caldera-core.php
Created Mar 26, 2019
add CORS to caldera forms
View caldera-core.php
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");
View .htaccess
<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"
View navigation quickfix
$("button.navbar-toggle").removeAttr( "data-toggle" );
$("button.navbar-toggle").click( function(){ $("#navbar-collapse-1").toggleClass("in"); } );
View gist:db22cb2a4ef621511fe38224bf18c591
Macagare / gist:3999346
Created Nov 2, 2012
HTML: HTML template
View gist:3999346
<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<!--[if IE]>
<script src=""></script>
Macagare / gist:3999349
Created Nov 2, 2012
Coldfusion: paypal api
View gist:3999349
<!-- read post from PayPal system and add 'cmd' -->
<CFSET str="cmd=_notify-validate">
<CFLOOP INDEX="TheField" list="#Form.FieldNames#">
<CFSET str = str & "&#LCase(TheField)#=#URLEncodedFormat(Form[TheField])#">
<CFIF IsDefined("FORM.payment_date")>
<CFSET str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
<CFIF IsDefined("FORM.subscr_date")>
<CFSET str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
Macagare / compareTables.sql
Created Apr 3, 2017
compare two table for missing ids
View compareTables.sql
SELECT table1.ID
FROM table1
LEFT OUTER JOIN table2 ON table1.ID = table2.ID
You can’t perform that action at this time.