Skip to content

Instantly share code, notes, and snippets.

View danieljin's full-sized avatar

Daniel Jin danieljin

View GitHub Profile
@Braytiner
Braytiner / Windows Defender Exclusions VS 2019.ps1
Last active November 16, 2023 18:50 — forked from dknoodle/Windows Defender Exclusions VS 2017.ps1
Adds Windows Defender exclusions for Visual Studio 2019
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\source\repos') > $null
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio Services') > $null
$pathExclusions.Add($userPath + '\AppData\Local\GitCredentialManager') > $null
@krisbulman
krisbulman / countCSSRules.js
Last active August 25, 2022 19:53 — forked from psebborn/countCSSRules.js
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE. — This snippet has been modified to count more than just the first level of CSSStyleRule objects within CSSMediaRule.
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@gregjsmith
gregjsmith / tests.js
Created February 14, 2014 07:15
Test setup for Angular / QUnit / Sinon
var serviceLocator = angular.injector(['ng', 'nameOfAngularApp']); // used to get dependencies like controllers / filters etc
var scope = {}; // a clean scope to test
var $controllers = serviceLocator.get('$controller'); //get injector that can retrieve controllers
var $filters = serviceLocator.get("$filter"); // get filter injector
var someService; // define a global used in all tests
QUnit.module('the module name', { // define the module - qualify with QUnit namespace to avoid conflict with Angular
setup: function () {
scope = serviceLocator.get('$rootScope').$new(); // get a clean scope
$controllers('theControllerBeingTested', { $scope: scope }) // get the controller to test