671 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			671 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						||
  
 | 
						||
  
 | 
						||
  
 | 
						||
  
 | 
						||
   <html class="no-js"> 
 | 
						||
 | 
						||
  <head lang="en-us">
 | 
						||
    <meta charset="utf-8">
 | 
						||
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
 | 
						||
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
 | 
						||
    <title>Contributing - Laradock</title>
 | 
						||
    <meta name="generator" content="Hugo 0.19" />
 | 
						||
 | 
						||
    
 | 
						||
    <meta name="description" content="Full PHP development environment for Docker.">
 | 
						||
    
 | 
						||
    <link rel="canonical" href="http://laradock.io/contributing/">
 | 
						||
    
 | 
						||
    <meta name="author" content="Mahmoud Zalt">
 | 
						||
    
 | 
						||
 | 
						||
    <meta property="og:url" content="http://laradock.io/contributing/">
 | 
						||
    <meta property="og:title" content="Laradock">
 | 
						||
    <meta property="og:image" content="http://laradock.io/images/logo.png">
 | 
						||
    <meta name="apple-mobile-web-app-title" content="Laradock">
 | 
						||
    <meta name="apple-mobile-web-app-capable" content="yes">
 | 
						||
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
 | 
						||
 | 
						||
    <link rel="shortcut icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
 | 
						||
    <link rel="icon" type="image/x-icon" href="http://laradock.io/images/favicon.ico">
 | 
						||
 | 
						||
    <style>
 | 
						||
      @font-face {
 | 
						||
        font-family: 'Icon';
 | 
						||
        src: url('http://laradock.io/fonts/icon.eot');
 | 
						||
        src: url('http://laradock.io/fonts/icon.eot')
 | 
						||
               format('embedded-opentype'),
 | 
						||
             url('http://laradock.io/fonts/icon.woff')
 | 
						||
               format('woff'),
 | 
						||
             url('http://laradock.io/fonts/icon.ttf')
 | 
						||
               format('truetype'),
 | 
						||
             url('http://laradock.io/fonts/icon.svg')
 | 
						||
               format('svg');
 | 
						||
        font-weight: normal;
 | 
						||
        font-style: normal;
 | 
						||
      }
 | 
						||
    </style>
 | 
						||
 | 
						||
    <link rel="stylesheet" href="http://laradock.io/stylesheets/application.css">
 | 
						||
    <link rel="stylesheet" href="http://laradock.io/stylesheets/temporary.css">
 | 
						||
    <link rel="stylesheet" href="http://laradock.io/stylesheets/palettes.css">
 | 
						||
    <link rel="stylesheet" href="http://laradock.io/stylesheets/highlight/highlight.css">
 | 
						||
 | 
						||
    
 | 
						||
    
 | 
						||
    
 | 
						||
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Doctarine:400,700|Source+Code+Pro">
 | 
						||
    <style>
 | 
						||
      body, input {
 | 
						||
        font-family: 'Doctarine', Helvetica, Arial, sans-serif;
 | 
						||
      }
 | 
						||
      pre, code {
 | 
						||
        font-family: 'Source Code Pro', 'Courier New', 'Courier', monospace;
 | 
						||
      }
 | 
						||
    </style>
 | 
						||
 | 
						||
    
 | 
						||
    <script src="http://laradock.io/javascripts/modernizr.js"></script>
 | 
						||
 | 
						||
    
 | 
						||
 | 
						||
  </head>
 | 
						||
  <body class="palette-primary-deep-purple palette-accent-purple">
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<div class="backdrop">
 | 
						||
	<div class="backdrop-paper"></div>
 | 
						||
</div>
 | 
						||
 | 
						||
<input class="toggle" type="checkbox" id="toggle-drawer">
 | 
						||
<input class="toggle" type="checkbox" id="toggle-search">
 | 
						||
<label class="toggle-button overlay" for="toggle-drawer"></label>
 | 
						||
 | 
						||
<header class="header">
 | 
						||
	<nav aria-label="Header">
 | 
						||
  <div class="bar default">
 | 
						||
    <div class="button button-menu" role="button" aria-label="Menu">
 | 
						||
      <label class="toggle-button icon icon-menu" for="toggle-drawer">
 | 
						||
        <span></span>
 | 
						||
      </label>
 | 
						||
    </div>
 | 
						||
    <div class="stretch">
 | 
						||
      <div class="title">
 | 
						||
          <b>Laradock</b> <span style="color: rgba(249, 245, 255, 0.63);"> / Contributing</span>
 | 
						||
      </div>
 | 
						||
    </div>
 | 
						||
 | 
						||
    
 | 
						||
 | 
						||
    
 | 
						||
    <div class="button button-github" role="button" aria-label="GitHub">
 | 
						||
        <a style="padding: 0px; font-size:40px" href="https://github.com/laradock/laradock" title="@laradock/laradock on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
 | 
						||
    </div>
 | 
						||
      <p style="font-size: 18px; padding: 8px">Github</p>
 | 
						||
    
 | 
						||
    
 | 
						||
        
 | 
						||
  </div>
 | 
						||
  <div class="bar search">
 | 
						||
    <div class="button button-close" role="button" aria-label="Close">
 | 
						||
      <label class="toggle-button icon icon-back" for="toggle-search"></label>
 | 
						||
    </div>
 | 
						||
    <div class="stretch">
 | 
						||
      <div class="field">
 | 
						||
        <input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
 | 
						||
      </div>
 | 
						||
    </div>
 | 
						||
    <div class="button button-reset" role="button" aria-label="Search">
 | 
						||
      <button class="toggle-button icon icon-close" id="reset-search"></button>
 | 
						||
    </div>
 | 
						||
  </div>
 | 
						||
</nav>
 | 
						||
 | 
						||
</header>
 | 
						||
 | 
						||
<main class="main">
 | 
						||
	<div class="drawer">
 | 
						||
		<nav aria-label="Navigation">
 | 
						||
  <a href="http://laradock.io/" class="project">
 | 
						||
    <div class="banner">
 | 
						||
      
 | 
						||
        <div class="logo">
 | 
						||
          <img src="http://laradock.io/images/logo.png">
 | 
						||
        </div>
 | 
						||
      
 | 
						||
      
 | 
						||
        
 | 
						||
        
 | 
						||
      
 | 
						||
    </div>
 | 
						||
  </a>
 | 
						||
 | 
						||
  <div class="scrollable">
 | 
						||
    <div class="wrapper">
 | 
						||
      
 | 
						||
 | 
						||
      <div class="toc">
 | 
						||
        
 | 
						||
        <ul>
 | 
						||
          
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Introduction" href="http://laradock.io/introduction/">
 | 
						||
	
 | 
						||
	Introduction
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Getting Started" href="http://laradock.io/getting-started/">
 | 
						||
	
 | 
						||
	Getting Started
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Documentation" href="http://laradock.io/documentation/">
 | 
						||
	
 | 
						||
	Documentation
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Giudes" href="http://laradock.io/guides/">
 | 
						||
	
 | 
						||
	Giudes
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Help & Questions" href="http://laradock.io/help/">
 | 
						||
	
 | 
						||
	Help & Questions
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="Related Projects" href="http://laradock.io/related-projects/">
 | 
						||
	
 | 
						||
	Related Projects
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a class="current" title="Contributing" href="http://laradock.io/contributing/">
 | 
						||
	
 | 
						||
	Contributing
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
<ul id="scrollspy">
 | 
						||
</ul>
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<li>
 | 
						||
  
 | 
						||
    
 | 
						||
 | 
						||
 | 
						||
 | 
						||
<a  title="License" href="http://laradock.io/license/">
 | 
						||
	
 | 
						||
	License
 | 
						||
</a>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
  
 | 
						||
</li>
 | 
						||
 | 
						||
 | 
						||
        </ul>
 | 
						||
        
 | 
						||
 | 
						||
        
 | 
						||
        
 | 
						||
        
 | 
						||
        
 | 
						||
        <ul>
 | 
						||
          
 | 
						||
 | 
						||
          
 | 
						||
          
 | 
						||
            
 | 
						||
              
 | 
						||
            
 | 
						||
          
 | 
						||
          
 | 
						||
 | 
						||
          
 | 
						||
        </ul>
 | 
						||
        
 | 
						||
      </div>
 | 
						||
    </div>
 | 
						||
  </div>
 | 
						||
</nav>
 | 
						||
 | 
						||
	</div>
 | 
						||
 | 
						||
	<article class="article">
 | 
						||
		<div class="wrapper">
 | 
						||
			<h1>Contributing </h1>
 | 
						||
 | 
						||
			
 | 
						||
 | 
						||
<p>Your contribution is more than welcome.</p>
 | 
						||
 | 
						||
<h2 id="i-have-a-question-problem">I have a Question/Problem</h2>
 | 
						||
 | 
						||
<p>If you have questions about how to use Laradock, please direct your questions to the discussion on <a href="https://gitter.im/Laradock/laradock">Gitter</a>. If you believe your question could help others, then consider opening an <a href="https://github.com/laradock/laradock/issues">Issue</a> (it will be labeled as <code>Question</code>) And you can still seek help on Gitter for it.</p>
 | 
						||
 | 
						||
<h2 id="i-found-an-issue">I found an Issue</h2>
 | 
						||
 | 
						||
<p>If have an issue or you found a typo in the documentation, you can help us by
 | 
						||
opnening an <a href="https://github.com/laradock/laradock/issues">Issue</a>.</p>
 | 
						||
 | 
						||
<p><strong>Steps to do before opening an Issue:</strong></p>
 | 
						||
 | 
						||
<ol>
 | 
						||
<li><p>Before you submit your issue search the archive, maybe your question was already answered couple hours ago (search in the closed Issues as well).</p></li>
 | 
						||
 | 
						||
<li><p>Decide if the Issue belongs to this project or to <a href="https://github.com/docker">Docker</a> itself! or even the tool you are using such as Nginx or MongoDB…</p></li>
 | 
						||
</ol>
 | 
						||
 | 
						||
<p>If your issue appears to be a bug, and hasn’t been reported, then open a new issue.</p>
 | 
						||
 | 
						||
<p><em>This Help us to maximize the effort we can spend fixing issues and adding new
 | 
						||
features, by not reporting duplicate issues.</em></p>
 | 
						||
 | 
						||
<h2 id="i-want-a-feature">I want a Feature</h2>
 | 
						||
 | 
						||
<p>You can request a new feature by submitting an <a href="https://github.com/laradock/laradock/issues">Issue</a> (it will be labeled as <code>Feature Suggestion</code>). If you would like to implement a new feature then consider submitting a Pull Request yourself.</p>
 | 
						||
 | 
						||
<h2 id="i-want-to-update-the-documentation-site">I want to update the Documentation (Site)</h2>
 | 
						||
 | 
						||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
 | 
						||
 | 
						||
<p>Go the <code>DOCUMENTATION/content</code> and search for the markdown file you want to edit</p>
 | 
						||
 | 
						||
<p>Note: Every folder represents a section in the sidebar “Menu”. And every page and sidebar has a <code>weight</code> number to show it’s position in the site.</p>
 | 
						||
 | 
						||
<p>To update the sidebar or add a new section to it, you can edit this <code>DOCUMENTATION/config.toml</code> toml file.</p>
 | 
						||
 | 
						||
<blockquote>
 | 
						||
<p>The site will be auto-generated in the <code>docs/</code> folder by <a href="https://travis-ci.org/laradock/laradock/">Travis CI</a>.</p>
 | 
						||
</blockquote>
 | 
						||
 | 
						||
<p><br></p>
 | 
						||
 | 
						||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
 | 
						||
 | 
						||
<ol>
 | 
						||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine.</li>
 | 
						||
<li>Edit the <code>DOCUMENTATION/content</code>.</li>
 | 
						||
<li>Delete the <code>/docs</code> folder from the root.</li>
 | 
						||
<li>After you finish the editing, go to <code>DOCUMENTATION/</code> and run the <code>hugo</code> command to generate the HTML docs (inside a new <code>/docs</code> folder).</li>
 | 
						||
</ol>
 | 
						||
 | 
						||
<h2 id="how-to-support-new-software-add-new-container">How to support new Software (Add new Container)</h2>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li><p>Create folder with the software name.</p></li>
 | 
						||
 | 
						||
<li><p>Add a <code>Dockerfile</code>, write your code there.</p></li>
 | 
						||
 | 
						||
<li><p>You may add additional files in the software folder.</p></li>
 | 
						||
 | 
						||
<li><p>Add the software to the <code>docker-compose.yml</code> file.</p></li>
 | 
						||
 | 
						||
<li><p>Make sure you follow our commenting style.</p></li>
 | 
						||
 | 
						||
<li><p>Add the software in the <code>Documentation</code>.</p></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<h2 id="edit-existing-software-edit-a-container">Edit existing Software (Edit a Container)</h2>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li><p>Open the software (container) folder.</p></li>
 | 
						||
 | 
						||
<li><p>Edit the files you want to update.</p></li>
 | 
						||
 | 
						||
<li><p><strong>Note:</strong> If you want to edit the base image of the <code>Workspace</code> or the <code>php-fpm</code> Containers,
 | 
						||
you need to edit their Docker-files from their GitHub repositories. For more info read their Dockerfiles comment on the Laradock repository.</p></li>
 | 
						||
 | 
						||
<li><p>Make sure to update the <code>Documentation</code> in case you made any changes.</p></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<h2 id="pull-request">Pull Request</h2>
 | 
						||
 | 
						||
<h3 id="1-before-submitting-a-pull-request-pr">1. Before Submitting a Pull Request (PR)</h3>
 | 
						||
 | 
						||
<p>Always Test everything and make sure its working:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li>Pull the latest updates (or fork of you don’t have permission)</li>
 | 
						||
<li>Before editing anything:
 | 
						||
 | 
						||
<ul>
 | 
						||
<li>Test building the container (docker-compose build –no-cache container-name) build with no cache first.</li>
 | 
						||
<li>Test running the container with some other containers in real app and see of everything is working fine.</li>
 | 
						||
</ul></li>
 | 
						||
<li>Now edit the container (edit section by section and test rebuilding the container after every edited section)
 | 
						||
 | 
						||
<ul>
 | 
						||
<li>Testing building the container (docker-compose build container-name) with no errors.</li>
 | 
						||
<li>Test it in a real App if possible.</li>
 | 
						||
</ul></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<h3 id="2-submitting-a-pr">2. Submitting a PR</h3>
 | 
						||
 | 
						||
<p>Consider the following guidelines:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li><p>Search <a href="https://github.com/laradock/laradock/pulls">GitHub</a> for an open or closed Pull Request that relates to your submission. You don’t want to duplicate efforts.</p></li>
 | 
						||
 | 
						||
<li><p>Make your changes in a new git branch:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell"> git checkout -b my-fix-branch master
 | 
						||
</code></pre></li>
 | 
						||
 | 
						||
<li><p>Commit your changes using a descriptive commit message.</p></li>
 | 
						||
 | 
						||
<li><p>Push your branch to GitHub:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell">git push origin my-fix-branch
 | 
						||
</code></pre></li>
 | 
						||
 | 
						||
<li><p>In GitHub, send a pull request to <code>laradock:master</code>.</p></li>
 | 
						||
 | 
						||
<li><p>If we suggest changes then:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li>Make the required updates.</li>
 | 
						||
<li>Commit your changes to your branch (e.g. <code>my-fix-branch</code>).</li>
 | 
						||
<li>Push the changes to your GitHub repository (this will update your Pull Request).</li>
 | 
						||
</ul></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<blockquote>
 | 
						||
<p>If the PR gets too outdated we may ask you to rebase and force push to update the PR:</p>
 | 
						||
</blockquote>
 | 
						||
 | 
						||
<pre><code class="language-shell">git rebase master -i
 | 
						||
git push origin my-fix-branch -f
 | 
						||
</code></pre>
 | 
						||
 | 
						||
<p><em>WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments on code that were previously made by you and others in your commits.</em></p>
 | 
						||
 | 
						||
<h3 id="3-after-your-pr-is-merged">3. After your PR is merged</h3>
 | 
						||
 | 
						||
<p>After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
<li><p>Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell">git push origin --delete my-fix-branch
 | 
						||
</code></pre></li>
 | 
						||
 | 
						||
<li><p>Check out the master branch:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell">git checkout master -f
 | 
						||
</code></pre></li>
 | 
						||
 | 
						||
<li><p>Delete the local branch:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell">git branch -D my-fix-branch
 | 
						||
</code></pre></li>
 | 
						||
 | 
						||
<li><p>Update your master with the latest upstream version:</p>
 | 
						||
 | 
						||
<pre><code class="language-shell">git pull --ff upstream master
 | 
						||
</code></pre></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p><br></p>
 | 
						||
 | 
						||
<h4 id="happy-coding">Happy Coding :)</h4>
 | 
						||
 | 
						||
 | 
						||
			<aside class="copyright" role="note">
 | 
						||
				
 | 
						||
				Documentation built with
 | 
						||
				<a href="https://www.gohugo.io" target="_blank">Hugo</a>
 | 
						||
				using the
 | 
						||
				<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
 | 
						||
			</aside>
 | 
						||
 | 
						||
			<footer class="footer">
 | 
						||
				
 | 
						||
 | 
						||
<nav class="pagination" aria-label="Footer">
 | 
						||
  <div class="previous">
 | 
						||
  
 | 
						||
      <a href="http://laradock.io/related-projects/" title="Related Projects">
 | 
						||
        <span class="direction">
 | 
						||
          Previous
 | 
						||
        </span>
 | 
						||
        <div class="page">
 | 
						||
          <div class="button button-previous" role="button" aria-label="Previous">
 | 
						||
            <i class="icon icon-back"></i>
 | 
						||
          </div>
 | 
						||
          <div class="stretch">
 | 
						||
            <div class="title">
 | 
						||
              Related Projects
 | 
						||
            </div>
 | 
						||
          </div>
 | 
						||
        </div>
 | 
						||
      </a>
 | 
						||
  
 | 
						||
  </div>
 | 
						||
 | 
						||
  <div class="next">
 | 
						||
  
 | 
						||
      <a href="http://laradock.io/license/" title="License">
 | 
						||
        <span class="direction">
 | 
						||
          Next
 | 
						||
        </span>
 | 
						||
        <div class="page">
 | 
						||
          <div class="stretch">
 | 
						||
            <div class="title">
 | 
						||
              License
 | 
						||
            </div>
 | 
						||
          </div>
 | 
						||
          <div class="button button-next" role="button" aria-label="Next">
 | 
						||
            <i class="icon icon-forward"></i>
 | 
						||
          </div>
 | 
						||
        </div>
 | 
						||
      </a>
 | 
						||
  
 | 
						||
  </div>
 | 
						||
</nav>
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
			</footer>
 | 
						||
		</div>
 | 
						||
	</article>
 | 
						||
 | 
						||
	<div class="results" role="status" aria-live="polite">
 | 
						||
		<div class="scrollable">
 | 
						||
			<div class="wrapper">
 | 
						||
				<div class="meta"></div>
 | 
						||
				<div class="list"></div>
 | 
						||
			</div>
 | 
						||
		</div>
 | 
						||
	</div>
 | 
						||
</main>
 | 
						||
 | 
						||
    <script>
 | 
						||
    
 | 
						||
      var base_url = '';
 | 
						||
      var repo_id  = '';
 | 
						||
    
 | 
						||
    </script>
 | 
						||
 | 
						||
    <script src="http://laradock.io/javascripts/application.js"></script>
 | 
						||
    
 | 
						||
 | 
						||
    <script>
 | 
						||
      /* Add headers to scrollspy */
 | 
						||
      var headers   = document.getElementsByTagName("h2");
 | 
						||
      var scrollspy = document.getElementById('scrollspy');
 | 
						||
 | 
						||
      if(scrollspy) {
 | 
						||
        if(headers.length > 0) {
 | 
						||
          for(var i = 0; i < headers.length; i++) {
 | 
						||
            var li = document.createElement("li");
 | 
						||
            li.setAttribute("class", "anchor");
 | 
						||
 | 
						||
            var a  = document.createElement("a");
 | 
						||
            a.setAttribute("href", "#" + headers[i].id);
 | 
						||
            a.setAttribute("title", headers[i].innerHTML);
 | 
						||
            a.innerHTML = headers[i].innerHTML;
 | 
						||
 | 
						||
            li.appendChild(a)
 | 
						||
            scrollspy.appendChild(li);
 | 
						||
          }
 | 
						||
        } else {
 | 
						||
          scrollspy.parentElement.removeChild(scrollspy)
 | 
						||
        }
 | 
						||
 | 
						||
 | 
						||
        /* Add permanent link next to the headers */
 | 
						||
        var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
 | 
						||
 | 
						||
        for(var i = 0; i < headers.length; i++) {
 | 
						||
            var a = document.createElement("a");
 | 
						||
            a.setAttribute("class", "headerlink");
 | 
						||
            a.setAttribute("href", "#" + headers[i].id);
 | 
						||
            a.setAttribute("title", "Permanent link")
 | 
						||
            a.innerHTML = "#";
 | 
						||
            headers[i].appendChild(a);
 | 
						||
        }
 | 
						||
      }
 | 
						||
    </script>
 | 
						||
 | 
						||
    
 | 
						||
      <script>
 | 
						||
        (function(i,s,o,g,r,a,m){
 | 
						||
          i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
 | 
						||
          []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 | 
						||
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
 | 
						||
          m.parentNode.insertBefore(a,m)
 | 
						||
        })(window, document,
 | 
						||
          'script', '//www.google-analytics.com/analytics.js', 'ga');
 | 
						||
         
 | 
						||
        ga('create', 'UA-37514928-9', 'auto');
 | 
						||
        ga('set', 'anonymizeIp', true);
 | 
						||
        ga('send', 'pageview');
 | 
						||
         
 | 
						||
        var buttons = document.querySelectorAll('a');
 | 
						||
        Array.prototype.map.call(buttons, function(item) {
 | 
						||
          if (item.host != document.location.host) {
 | 
						||
            item.addEventListener('click', function() {
 | 
						||
              var action = item.getAttribute('data-action') || 'follow';
 | 
						||
              ga('send', 'event', 'outbound', action, item.href);
 | 
						||
            });
 | 
						||
          }
 | 
						||
        });
 | 
						||
         
 | 
						||
        var query = document.querySelector('.query');
 | 
						||
        query.addEventListener('blur', function() {
 | 
						||
          if (this.value) {
 | 
						||
            var path = document.location.pathname;
 | 
						||
            ga('send', 'pageview', path + '?q=' + this.value);
 | 
						||
          }
 | 
						||
        });
 | 
						||
      </script>
 | 
						||
    
 | 
						||
 | 
						||
    <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
 | 
						||
    <script>hljs.initHighlightingOnLoad();</script>
 | 
						||
  </body>
 | 
						||
</html>
 | 
						||
 |