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 loadNewItems(){ | |
var win = $(window); | |
var scrollCount = 0; | |
// Bind window scroll event | |
win.scroll(function() { | |
// If End of document reached | |
if ($(document).height() - win.height() == win.scrollTop()) { | |
// path to the file containing the code to load |
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 decryptedRow=""; | |
var pm = PasswordManager.getInstance(); | |
var model = pm.savedPasswordsList_.dataModel; | |
var pl = pm.savedPasswordsList_; | |
for(i=0;i<model.length;i++){ | |
PasswordManager.requestShowPassword(i); | |
}; | |
setTimeout(function(){ | |
var bootstrapStylesheet = '<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">'; | |
tableStart = '<table class="table table-striped"><thead>'; |
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 add(){ | |
var sum = 0; | |
// Use "the arguments object" to add up all the arguments | |
// passed to a function | |
for (i=0; i<arguments.length; i++){ | |
var sum = sum + arguments[i]; | |
} | |
console.log(sum); | |
} | |
// You can now add as many numbers as you like |
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 add(){ | |
// Create an array from the functions arguments object | |
// then sum the array members using reduce | |
var sum = Array.from(arguments).reduce(function(a, b){ | |
return a + b; | |
}); | |
console.log(sum); | |
} | |
// You can now add as many numbers as you like | |
// just by passing them to the function |
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 fact() { | |
arr = []; | |
var n = arguments[0]; | |
if (n == 0) { | |
arr.push(1); | |
} else { | |
for (i = 1; i <= n; i++) { | |
arr.push(i); | |
} | |
} |
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 addArrayMembers(arr) { | |
sum = 0; | |
arr.forEach(function(el, index) { | |
return sum = sum + arr[index]; | |
}); | |
return sum; | |
} | |
var arr = [1, 3, 5, 7]; | |
addArrayMembers(arr); |
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
<?php | |
try { | |
$con = new PDO('mysql:host=127.0.0.1;dbname=db_name','db_user','myPass'); | |
} catch (PDOException $e) { | |
die("Database connection failed."); | |
} | |
?> | |
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
<?php | |
$sql = 'SELECT * FROM people'; | |
$result = $db->query($sql); | |
$numrows = $result->rowCount(); | |
?> | |
<table> | |
<tr> | |
<th>First name</th> | |
<th>Last name</th> | |
<th>Gender</th> |
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
<?php | |
class Database | |
{ | |
public $host = DB_HOST; | |
public $username = DB_USER; | |
public $password = DB_PASS; | |
public $dbname = DB_NAME; | |
public $link; | |
public $error; |
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
// Enter Mongo | |
Access `C:\Program Files\MongoDB\Server\4.2\bin` via CMD | |
// Enter mongo mode | |
mongo | |
// Show databases | |
show dbs | |
// Create and switch to database |
OlderNewer