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
# ask the user for input | |
# find the divisors of that number | |
def imperative_solution(end): | |
numrange = range(1, num + 1) | |
divisors = [] | |
for i in numrange: | |
if num % i == 0: | |
divisors.append(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
#!/usr/bin/python | |
import sys | |
# Description of the problem is | |
# found at http://bit.ly/python-top-exer1 | |
def sum_to(end): | |
num_list = range(1, int(end)) | |
sum = 0 |
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
package com.example.ted.eventhandling_innerclass_as_listener; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.Toast; | |
public class MainActivity extends AppCompatActivity { |
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
<html ng-app="app"> | |
<body ng-controller="ctrl"> | |
<my-directive></my-directive> | |
<author-card></author-card> | |
<input type="text" ng-model="myinput"><br/> | |
<button ng-click="clickMe(myinput)"> Click me</button> | |
{{ greeting }} |
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
<html ng-app> | |
<body ng-controller="ctrl"> | |
<div id="disp"> | |
<input type="number" placeholder="type a number" ng-model="fno"/><br/> | |
<input type="number" placeholder="type a number" ng-model="sno"/><br/> | |
<button ng-click="calculate()">Calculate</button> | |
<div id = "out"> | |
{{ gcf }} | |
</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
let app = angular.module('app', []); | |
app.controller('ctrl', ($scope) => { | |
$scope.numbers = [0,1,2,3,4,5,6,7,8,9,10]; | |
$scope.names = [ | |
{name: 'James Gosling', likes: 2 }, | |
{name: 'Misko Hevery', likes: 3 }, | |
{name: 'Ryan Dahl', likes: 4 }, |
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
place these snippets before the line "app.listen(. . .)" |
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
const myservice = ($http) => { | |
let github = () => { | |
return $http.get('https://api.github.com/users/angular') | |
.then((data) => { | |
return data.data; | |
}) | |
} | |
return { | |
xgithub: github | |
} |
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
<html ng-app="app"> | |
<body ng-controller='ctrl'> | |
{{ count }} | |
{{ user.name }} | |
<button ng-click="increase()">+</button> | |
<div my-directive></div> | |
</body> | |
<script src="bower_components/angular/angular.js"></script> | |
<script src="1.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
Place this code in server.js. Right before "app.listen(port)" | |
/// | |
app.get('/author/:lastname', (req,res) => { | |
let name = req.params.lastname; | |
Author.findOne({'lastname': {'$regex': name,$options: 'i' }}).lean().exec((err,data)=> { | |
if(err) { | |
res.send(err); | |
} |