This file contains hidden or 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 getNumbers(n) { | |
function generateRange(n) { | |
var arr = []; | |
for (var idx = 1; n*n > arr.length; idx++) { | |
arr.push(idx); | |
} | |
return arr; | |
} | |
function generateSquare(n) { |
This file contains hidden or 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 deepSearch(arr, x) { | |
var result = false; | |
function loopSearch(arr) { | |
arr.forEach(function(item, i, arr) { | |
if (item instanceof Array) { | |
loopSearch(item); | |
} else { | |
if (item == x) { | |
result = true; |
This file contains hidden or 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
python manage.py dumpdata --exclude auth.permission --exclude contenttypes --exclude sessions --exclude admin > all.json |
This file contains hidden or 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
void main() { | |
// 1. Создать глобальную переменную типа int с именем a | |
int a = 11; | |
print(a); | |
double showLocalVariable() { | |
// 2. Создать локальную переменную типа double с именем b | |
double b = 20.0; | |
return b; | |
} |
This file contains hidden or 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
void main() { | |
// 1. Используя switch, напишите программу в методе main(), которая выводит название месяца по номеру от 1 до 12. | |
String getMonthName(int monthIndex) { | |
String result = 'Нет такого месяца'; | |
switch (monthIndex) { | |
case 1: | |
result = 'Январь'; | |
break; |
This file contains hidden or 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
import 'dart:convert'; | |
import 'dart:io'; | |
void main() { | |
print('Складываем два простых числа. A + B'); | |
print('Введите первое число, A:'); | |
String rawA = stdin.readLineSync(encoding: Encoding.getByName('utf-8')); | |
print('Введите второе число, B:'); | |
String rawB = stdin.readLineSync(encoding: Encoding.getByName('utf-8')); |
This file contains hidden or 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
import 'dart:math'; | |
void main() { | |
// 1. Создайте текстовую переменную a = ‘hello world’; Напишите функцию, без возвращаемого значения. Функция меняет порядок слов на обратный. Например было ‘hello world’, стало ‘world hello’ | |
String a = "hello world"; | |
void reverseWords(String words) { | |
words = words.split(' ').reversed.toList().join(' '); | |
print(words); |
This file contains hidden or 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. Реализуйте класс Student (Студент), который будет наследоваться от класса User. Класс должен иметь следующие свойства: | |
class User { | |
String firstName; | |
String lastName; | |
User( | |
this.firstName, | |
this.lastName, | |
); |
This file contains hidden or 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
import 'dart:async'; | |
import 'dart:convert'; | |
import 'dart:io'; | |
void main() async { | |
print('Напишите что-нибудь'); | |
Future<String> inputFuture() async { | |
String rawInput = stdin.readLineSync(encoding: Encoding.getByName('utf-8')); | |
return rawInput; |
This file contains hidden or 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
from applications.press.models import Post | |
from tempfile import NamedTemporaryFile | |
posts = Post.objects.all() | |
for post in posts: | |
if not post.image: | |
continue | |
tmp = NamedTemporaryFile(delete=True) | |
try: | |
tmp.write(post.image.read()) |
OlderNewer