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
<!-- custom targets --> | |
<Target Name="BeforeBuild"> | |
<Message Text="Node Check Started" /> | |
<Exec Command="node || start http://nodejs.org && echo You need to install NodeJS" ContinueOnError="false" /> | |
<Message Text="Node Check Ended" /> | |
<Message Text="NPM Install Started" /> | |
<Exec WorkingDirectory="$(ProjectDir)" Command="npm install" ContinueOnError="false" /> | |
<Message Text="NPM Install Ended" /> |
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
<div class="brads-element"> | |
<p>{{counter}}</p> | |
<button (click)="increase()">Increase</button> | |
<button (click)="descrease()">Decrease</button> | |
</div> |
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
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem | |
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem | |
// to avoid the entire page breaking, without having to do a check at each usage of Storage. | |
if (typeof window.localStorage === 'object') { | |
try { | |
window.localStorage.setItem('localStorage', 1); | |
window.localStorage.removeItem('localStorage'); | |
} catch (e) { | |
(function () { | |
var Storage = function (type) { |
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
// The result of the 'exampleFunction' is difficult to reason about. | |
let n = 10; | |
// function with a side effect | |
const exampleFunction = function ( i ) { | |
return n = n + i; | |
}; | |
exampleFunction( 2 ); // result is 12 |
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
/** | |
Decalartive style example of a program that will find the average grade for classes with | |
more than one student enrolled. | |
**/ | |
let courses = [ | |
{ name: 'functional fundamentals', enrolled: 2, grade: 100, students: 30 }, | |
{ name: 'category theory', enrolled: 2, grade: 80, students: 25 }, | |
{ name: 'basket weaving', enrolled: 1, grade: 89, students: 43 } | |
]; |
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
/*** | |
Number is a palindrome if it is equal to the number with digits in reversed order. For example, 5, 44, 171, 4884 are palindromes and 43, 194, 4773 are not palindromes. | |
Write a method palindrome_chain_length which takes a positive number and returns the number of special steps needed to obtain a palindrome. The special step is: "reverse the digits, and add to the original number". If the resulting number is not a palindrome, repeat the procedure with the sum until the resulting number is a palindrome. | |
If the input number is already a palindrome, the number of steps is 0. | |
Input will always be a positive integer. |
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
/** | |
Imperative style example of a program that will find the average grade for classes with | |
more than one student enrolled. | |
**/ | |
let courses = [ | |
{ name: 'functional fundamentals', enrolled: 2, grade: 100, students: 30 }, | |
{ name: 'category theory', enrolled: 2, grade: 80, students: 25 }, | |
{ name: 'basket weaving', enrolled: 1, grade: 89, students: 43 } | |
]; |
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
let courses = [ | |
{ name: 'functional fundamentals', enrolled: 2, grade: 100, students: 30 }, | |
{ name: 'category theory', enrolled: 2, grade: 80, students: 25 }, | |
{ name: 'basket weaving', enrolled: 1, grade: 89, students: 43 } | |
]; | |
function avg(nums: number[]): number { | |
const total = nums.reduce((a,b) => a + b, 0); | |
return (nums.length == 0) ? 0 : total / nums.length; | |
} |
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 inArray(arr1, arr2) { | |
return arr1.filter(function(needle) { | |
return arr2.some(function(haystack) { | |
return haystack.indexOf(needle) > -1; | |
}); | |
}).sort(); | |
} |
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
var compose = function(f, g) { | |
return function(x) { | |
return f(g(x)); | |
}; | |
}; |
NewerOlder