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
<script src = "scripts/form.js"></script> | |
<div class="container" ng-app="formApp" ng-controller="formController"> | |
<div class="col-md-6 col-md-offset-3"> | |
<!-- PAGE TITLE --> | |
<div class="page-header"> | |
<h1><span class="glyphicon glyphicon-tower" style="font-size:20px"></span><span style="font-size:20px; margin-left:10px;">Send a direct e-mail to us</span></h1> | |
</div> | |
<!-- SHOW ERROR/SUCCESS MESSAGES --> | |
<div id="messages" class="well" ng-show="message"></div> | |
<!-- FORM --> |
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
// define angular module/app | |
var formApp = angular.module('formApp', []); | |
// create angular controller and pass in $scope and $http | |
function formController($scope, $http) { | |
// create a blank object to hold our form information | |
// $scope will allow this to pass between controller and view | |
$scope.formData = {}; |
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 | |
require_once('class.phpmailer.php'); | |
$errors = array(); // array to hold validation errors | |
$data = array(); // array to pass back data | |
// validate the variables ====================================================== | |
if (empty($_POST['name'])) | |
$errors['name'] = 'Name is required.'; |
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
module.exports = function (info) { | |
//private variable | |
var values = {}; | |
for(var prop in info) { | |
if(values[prop] !== 'undefined') { | |
values[prop] = info[prop]; | |
} | |
} | |
//return public function | |
return { |
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
//index.js | |
var Project = function() { | |
this.info = {}; | |
this.setValues = function(info) { | |
for(var prop in info) { | |
if(this.info[prop] !== 'undefined') { | |
this.info[prop] = info[prop]; | |
} |
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
//index.js | |
var Project = function() { | |
this.info = {}; | |
this.setValues = function(info) { | |
for(var prop in info) { | |
if(this.info[prop] !== 'undefined') { | |
this.info[prop] = info[prop]; | |
} | |
} | |
}; |
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
1. Write poly-fill of Object.create and explain why it worked: | |
if(typeof Object.create != "function") { | |
Object.create = function(param) { | |
var Fun = function(){}; | |
Fun.prototype = param; | |
return new Fun(); | |
} | |
} |
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
1. https://www.geeksforgeeks.org/top-10-algorithms-in-interview-questions/ | |
2. Dynamic Programming for Coding Interviews: A Bottom-Up Approach to Problem Solving | |
3. Narasimha karumanchi - Algorithms | |
4. https://www.hiredintech.com/system-design/ | |
5. Design from https://github.com/jwasham/coding-interview-university |
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
<input id="inputText" type="text" /> | |
function DataBind(domElement, object) { | |
this.element = domElement.element; | |
this.attribute = domElement.attribute; | |
this.event = domElement.event; | |
this.value = this.element[this.attribute]; | |
var self = this; |
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 Cache(maxSize) { | |
this.data = []; | |
this.maxSize = maxSize; | |
this.size = 0; | |
this.put = function(key, value, ttl) { | |
if(value.length > this.maxSize) { | |
throw new Error('string is too large'); | |
} |
OlderNewer