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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title></title> | |
<link rel="stylesheet" href="" /> | |
</head> | |
<body> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></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
.ir { | |
border:0; | |
font: 0/0 a; | |
text-shadow: none; | |
color: transparent; | |
background-color: transparent; | |
} |
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 AlphaNumericOnly(strSource As String) As String | |
Dim i As Integer | |
Dim strResult As String | |
For i = 1 To Len(strSource) | |
Select Case Asc(Mid(strSource, i, 1)) | |
Case 32, 48 To 57: 'include 32 if you want to include space | |
strResult = strResult & Mid(strSource, i, 1) | |
End Select | |
Next |
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
if ( cell.length || cell ) // testing if a cell contains something other than an empty string or 0 | |
// parsing through sheet - best practice, grab entire sheet and loop through array | |
data = sht.getDataRange().getValues(); | |
for ( var r = 0; r < data.length; r += 1 ) { // rows are looped through first | |
for ( var c = 0; c < data[0].length; c += 1 ) { // columns are next | |
data[r][c]; | |
} | |
} |
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 p = 25000, // principal amount | |
i = 0.06, // annual interest rate over the life HP | |
n = 60, // number of periods in life of HP | |
y = 12, // number of payment periods per annum | |
t = true, // if payment is to be made in ADVANCE | |
r = 1 + ( i / y ), // interest rate per period = 1.005 | |
S_n = ( (r^n) - 1 ) ) / ( r - 1 ), // limiting sum of payments = 69.77 | |
repay; // repayments per period | |
if ( t ) S_n *= r; // = 70.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
function findElem( el ) { | |
return !!~el.indexOf( this.val ); | |
} | |
// for example: | |
var arr = [ [ 18, "AAA" ], [ 19, "BBB" ], [ 20, "CCC" ] ]; | |
var query = 19; | |
console.log( arr.filter( findElem, { val: query } ) ); // returns [[19, "BBB"]] |
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 removeElem( el ) { | |
return !~el.indexOf( this.val ); | |
} | |
// for example: | |
var arr = [ [ 18, "AAA" ], [ 19, "BBB" ], [ 20, "CCC" ] ]; | |
var query = 19; | |
console.log( arr.filter( removeElem, { val: query } ) ); // returns [[18, "AAA"],[20,"CCC"]] |
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
// Every number can be reduced to 1 applying the following rules: | |
// If the number is even divide by two (halve it) | |
// If the number is odd multiply by 3 and add 1 | |
// Students were asked to find the largest "chain" from numbers 2 to 100. | |
// Answer is 97 (118) as shown by the following script, then 73 (115), then 54/55 (112). | |
// Exercise was done as a whole class. | |
var collatz = function(minNum, maxNum) { | |
var links = '', temp, steps; | |
for ( var i = minNum; i <= maxNum; i++ ) { |