Skip to content

Instantly share code, notes, and snippets.

@tkawa
Last active June 1, 2017 05:32
Show Gist options
  • Save tkawa/f883bd70346274a2acdedb600bd99a08 to your computer and use it in GitHub Desktop.
Save tkawa/f883bd70346274a2acdedb600bd99a08 to your computer and use it in GitHub Desktop.
module ApplicationHelper
def google_tag_manager_head
return unless Rails.env.production?
<<-HTML.html_safe
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WHX4V4D');</script>
<!-- End Google Tag Manager -->
HTML
end
def google_tag_manager_body
return unless Rails.env.production?
html = <<-SQL
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WHX4V4D"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
SQL
html.html_safe
end
def google_tag_manager_body2
return unless Rails.env.production?
html = <<-HTML
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WHX4V4D"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
HTML
html.html_safe
end
end
sql = <<-SQL
SELECT * FROM employees
SQL
sql = <<-EOS
SELECT * FROM employees
EOS
html = <<-HTML
<div>
<a href="くりにっき">http://sue445.hatenablog.com/</a>
</div>
HTML
html = <<-EOS
<div>
<a href="くりにっき">http://sue445.hatenablog.com/</a>
</div>
EOS
js = <<-JAVASCRIPT
var sum = 0;
for(var i = 0; i < 10; i++){
sum += i;
}
JAVASCRIPT
js = <<-EOS
var sum = 0;
for(var i = 0; i < 10; i++){
sum += i;
}
EOS
json = <<-JSON
{
title: "Dokidoki Precure",
menbers: ["Cure Heart", "Cure Diamond", "Cure Rosetta", "Cure Sword"],
}
JSON
json = <<-EOS
{
title: "Dokidoki Precure",
menbers: ["Cure Heart", "Cure Diamond", "Cure Rosetta", "Cure Sword"],
}
EOS
ruby = <<-RUBY
(1 .. 10).inject(0){|sum, n| sum += n }
RUBY
ruby = <<-EOS
(1 .. 10).inject(0){|sum, n| sum += n }
EOS
java = <<-JAVA
int sum = 0;
for(int i = 0; i < 10; i++){
sum += i;
}
JAVA
java = <<-GROOVY
int sum = 0
for(int i = 0; i < 10; i++){
sum += i
}
GROOVY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment