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
# Only use either one: non-www to www or www to non-www. | |
# Redirecting non-www to www | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] | |
# Redirecting www to non-www | |
RewriteEngine On | |
RewriteBase / |
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
<a href="http://www.cmee.co.nz/blog" onClick="ga('send', 'event', 'Contact Form', 'Submit');">Submit Button</a> | |
// Be sure to add event tracking with category = Contact Form and action = Submit on Google Analytics itself. |
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
--http://sqlzoo.net/wiki/SELECT_from_Nobel_Tutorial | |
--1. | |
SELECT * FROM nobel WHERE yr = 1950 | |
--2. | |
SELECT winner FROM nobel WHERE yr = 1962 AND subject = 'Literature' | |
--3. | |
SELECT yr, subject FROM nobel WHERE winner = 'Albert Einstein' |
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
x <- 1 | |
for (i in 1:10) { | |
while (x < 5) { | |
print(x) | |
x <- x + i | |
if (x >= 5) { | |
break | |
} | |
} | |
if (i >= 5) { |
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
from datetime import datetime, timedelta | |
first_half = datetime(2016, 11, 18) | |
second_half = first_half + timedelta(days=1) | |
print("http://www.facebook.com/download?file={}".format(first_half.strftime("%d-%m-%Y"))) | |
print("E:/Work/file_{}-{}.csv".format(first_half.strftime("%d_%B_%Y"), second_half.strftime("%d_%B_%Y"))) |
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
require(RODBC) | |
con <- odbcConnect("dsn") | |
clean <- function(x) { | |
if (is.character(x)) { | |
out <- paste0("'", x, "'") | |
} else if (is.na(x)) { | |
out <- "NULL" | |
} else { |
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
knitr::knit2pdf("document.Rtex") |
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
/* | |
Copied from https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js | |
*/ | |
/** | |
* Copyright 2012-2017, Plotly, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. |
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 use as custom variable in Google Tag Manager. | |
function() { | |
try { | |
var tracker = ga.getAll()[0]; | |
return tracker.get('clientId'); | |
} catch(e) { | |
return 'N/A'; | |
} | |
} |
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
# rbind uneven columns | |
# dummy data | |
x <- data.frame(name = "alice", | |
date = 1, | |
time = 3) | |
y <- data.frame(name = "bob", | |
time = 2) | |
print(x) | |
print(y) |
OlderNewer