-
Open your project (if you're using WebPack, obviously)
-
npm install sinon --save-dev
-
You should now have Sinon in your node modules and listed in your
package.json
file -
In your tests, require Sinon:
var sinon = require('sinon');
orimport * as sinon from 'sinon';
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 azure.devops.connection import Connection | |
from azure.devops.v5_1.core import TeamProject | |
from azure.devops.v5_1.git import GitPush, GitRefUpdate, GitCommit | |
from msrest.authentication import BasicAuthentication | |
from msrest.universal_http import ClientRequest | |
# Authenticate | |
credentials = BasicAuthentication('', token) | |
connection = Connection(base_url=f'https://dev.azure.com/{org}', creds=credentials) |
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
$git = "cmd.exe /C git describe --abbrev=0 --tags"; | |
$tag = (Invoke-Expression -Command:$git).substring(1); | |
$rev = $env:BUILD_BUILDNUMBER; | |
$build = "$tag-$rev"; | |
Write-Host "$("##vso[build.updatebuildnumber]") $($build)"; |
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
(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','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-173474946-1', 'auto'); | |
ga('send', 'pageview'); |
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
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-173474946-1"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'UA-173474946-1'); | |
</script> |
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
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
Promise.all([ | |
new Promise((resolve) => { | |
var script = document.createElement('script'); | |
script.src = "https://www.googletagmanager.com/gtag/js?id=UA-173474946-1"; | |
script.async = true; | |
document.body.appendChild(script); | |
resolve(); |
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
import { Component, OnInit } from '@angular/core'; | |
declare var ga: any; | |
@Component({ | |
selector: 'app-first-page', | |
templateUrl: './first-page.component.html', | |
styleUrls: ['./first-page.component.scss'] | |
}) | |
export class FirstPageComponent implements OnInit { |
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
import { Component, OnInit } from '@angular/core'; | |
declare var gtag: any; | |
@Component({ | |
selector: 'app-first-page', | |
templateUrl: './first-page.component.html', | |
styleUrls: ['./first-page.component.scss'] | |
}) | |
export class FirstPageComponent implements OnInit { |
OlderNewer