Just run: “npm set strict-ssl false”
Author: coreboarder
How to update each dependency in package.json to the latest version?
If you have a package.json file with statically defined versions the day is probably going to come where you will need to update. To do so you can run
npm i -g npm-check-updates
npm-check-updates -u
npm install
Using PowerShell to test for broken URL redirects
This PowerShell script iterates through a list of URLS from a CSV file looking for broken redirects. If any are found they are noted to a file.
#------------------------------------------------------------ cls #------------------------------------------------------------ # BEGIN: Config #------------------------------------------------------------ # Where are the files? $path = "C:\checkLinks"; # Do NOT end with \ # Source $csv = import-csv -Path "$path\source.csv"; # Report $targetFile = "report.csv"; # Where does the site send you to if a link is broken? Look at "OriginalString" in code as it's possibly not what you assume it is. $redirStr = "/error"; # What is the name of the column in the CSV file that has the URLs? $urlColumn = "url"; #------------------------------------------------------------ # END: Config #------------------------------------------------------------ #------------------------------------------------------------ # BEGIN: SUPPORTING FUNCTIONS #------------------------------------------------------------ #============================================================ # BEGIN: Get-URL # DESC: Receives params, checks URL for redirect and if redirect # matches str writes to report file. #============================================================ function Get-URL { param([string]$url) try { "Checking: $url" #======================================================== $wr = [System.Net.HttpWebRequest]::Create($url); $wrRsp = $wr.GetResponse(); $temp = $wrRsp.ResponseUri.AbsolutePath $redirectURL = $wrRsp.ResponseUri.OriginalString $redirectURL if ($temp -like $redirStr) { Add-Content $path\$targetFile "$url" }; $wrRsp.Close(); #======================================================== } catch { $errorStatus = "Exception Message: " + $_.Exception.Message; Write-Host $errorStatus; } }; #============================================================ # END: Get-URL #============================================================ #------------------------------------------------------------ # END: SUPPORTING FUNCTIONS #------------------------------------------------------------ #============================================================ # START MAIN #============================================================ #============================================================ # BEGIN: Step 1 #============================================================ # A: Go to folder cd $path # B: Does report file exist? If no, create it. if (!(Test-Path "$path\$targetFile")) { New-Item -path $path -name $targetFile -type "file" }; #============================================================ # END: Step 1 #============================================================ #============================================================ # BEGIN: Step 2 #============================================================ foreach($line in $csv) { # Loop through each row and check if URL has value. $properties = $line | Get-Member -MemberType Properties for($i=0; $i -lt $properties.Count;$i++) { $column = $properties[$i] $columnvalue = $line | Select -ExpandProperty $column.Name #----------------------------------------------------- # BEGIN: Send to check URL #----------------------------------------------------- if ($column.Name -eq $urlColumn){ if ($columnvalue.Length -gt 4){ Get-URL $columnvalue; }; }; #----------------------------------------------------- # END: Send to check URL #----------------------------------------------------- }; }; #============================================================ # END: Step 2 #============================================================
How to compare two Excel / CSV / XLSX files using PowerShell
The following PowerShell script allows you to compare ALL the columns in two CSV files contents against each other.
cls # Import the files $file1 = import-csv -Path "file1.csv"; $file2 = import-csv -Path "file2.csv"; # Get the list of properties $props1 = $file1 | gm -MemberType NoteProperty | select -expand Name | sort | % {"$_"} $props2 = $file2 | gm -MemberType NoteProperty | select -expand Name | sort | % {"$_"} if(Compare-Object $props1 $props2) { # Check that properties match throw "Properties are not the same! [$props1] [$props2]" } else { # Pass properties list to Compare-Object "Checking $props1" Compare-Object $file1 $file2 -Property $props1 }
Visual Studio 2015 Angular2 es6-shim missing
To fix when in the project directory run:
tsd install es6-shim -g
TSD: Error: self signed certificate in certificate chain
If you encounter this (behind a firewall etc.) and are on a Windows machine create a .tsdrc file with the below in it.
{
"strictSSL": false } https://github.com/DefinitelyTyped/tsd#tsdrc
git clone error: fatal: unable to access… SSL certificate problem: self signed certificate in certificate chain
SharePoint list item popovers on hover with AngularJS
Here’s how you can create Bootstrap style popovers of SharePoint list items using AngularJS.
<!DOCTYPE html>
<head>
<link rel=”stylesheet” href=”bootstrap.css” />
<link rel=”stylesheet” href=”font-awesome.css” />
<script type=”text/javascript” src=”modernizr.custom.js”></script>
<script type=”text/javascript” src=”jquery.js”></script>
<script type=”text/javascript” src=”angular.min.js”></script>
<script type=”text/javascript” src=”bootstrap.js”></script>
<script type=”text/javascript” src=”ui-bootstrap-tpls.min.js”></script>
</head>
<body ng-app=”toolTips”>
<div ng-controller=”mainController”>
<table>
<tr ng-repeat=”faq in faqs” bs-popover>
<td>
<a href=”#” data-popover=”true” rel=”popover” data-content=”{{faq.Body}}” data-original-title=”{{faq.Title}}”>
{{faq.Title}}
</a>
</td>
</tr>
</table>
</div>
<script type=”text/javascript”>
var app = angular.module(‘toolTips’, [‘ui.bootstrap’]);
app.controller(‘mainController’, function($scope, $http, $sce) {
$http({
method: ‘GET’,
url: “/_api/web/lists/getByTitle(‘someList)/items?$orderby=Title asc”,
cache: true,
headers: { “Accept”: “application/json;odata=verbose” }
}).success(function (data, status, headers, config) {
$scope.faqs = data.d.results;
//$scope.trustAsHtml = $sce.trustAsHtml;
$(“#contentLoading”).hide();
}).error(function (data, status, headers, config) {
});
});
app.directive(‘bsPopover’, function() {
return function(scope, element, attrs) {
element.find(“a[rel=popover]”).popover({ placement: ‘bottom’, html: ‘true’});
};
});
$(‘body’).popover({ selector: ‘[data-popover]’, trigger: ‘click hover’, placement: ‘auto’, delay: {show: 50, hide: 2000}});
</script>
</body>
</html>
How to change Xbox streaming on Windows 10 to “very high quality”
There’s a “very high quality” option that can be unlocked by tinkering with some of the Xbox app’s configuration files.
To enable:
- Edit userconsoledata in the xbox app folder C:\Users\%USERNAME%\AppData\Local\Packages\Microsoft.XboxApp_~~~~~~\LocalState
- Change IsInternalPreview to true.
As others have noted it can overwhelm your network if you’re due for an upgrade…
https://www.reddit.com/r/xboxone/comments/3gq0pk/very_high_settings_in_xbox_streaming/
Testing AngularJS on SharePoint: 1 Installing Protractor on Windows
1: Install Protractor and Webdriver-Manager
Open a Node command prompt
Two tools will be installed when you run “npm install -g protractor“.
- Protractor: https://angular.github.io/protractor/#/
- Webdriver-Manager: https://www.npmjs.com/package/webdriver-manager
Test your install by running “protractor –version”
2: Update Webdriver-Manager
Next, download some needed binaries with “webdriver-manager update”
3: Start the server
Start the server with “webdriver-manager start“.
What you should have now is a running instance of Selenium. Protractor tests send their requests to this server which controls the local browser. Status information should be visible here: http://localhost:4444/wd/hub
4: Create a simple test
This will require two files. One with some basic configuration information “conf.js” and another with a simple test “todo-spec.js”. Put the following in each respective file.
conf.js
exports.config = {
seleniumAddress: ‘http://localhost:4444/wd/hub’,
specs: [‘todo-spec.js’]
};
todo-spec.js
describe(‘angularjs homepage todo list’, function() {
it(‘should add a todo’, function() {
browser.get(‘https://angularjs.org’);
element(by.model(‘todoList.todoText’)).sendKeys(‘write first protractor test’);
element(by.css(‘[value=”add”]’)).click();
var todoList = element.all(by.repeater(‘todo in todoList.todos’));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual(‘write first protractor test’);
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css(‘input’)).click();
var completedAmount = element.all(by.css(‘.done-true’));
expect(completedAmount.count()).toEqual(2);
});
});
To run the test, from the Node command prompt, cd into the folder where you have saved the two files and execute the following “protractor conf.js“.