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
$(document).ready(function() { // вся магия после загрузки страницы | |
$("#ajaxform").submit(function(){ // перехватываем все при событии отправки | |
var form = $(this); // запишем форму, чтобы потом не было проблем с this | |
var error = false; // предварительно ошибок нет | |
form.find('input, textarea').each( function(){ // пробежим по каждому полю в форме | |
if ($(this).val() == '') { // если находим пустое | |
alert('Заполните поле "'+$(this).attr('placeholder')+'"!'); // говорим заполняй! | |
error = true; // ошибка | |
} | |
}); |
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
.clearfix:after { | |
clear: both; | |
color: transparent; | |
content: "."; | |
display: block; | |
font-size: 0; | |
zoom: 1; | |
} |
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(){ | |
$('a[href^="#"]').click(function(){ | |
var target = $(this).attr('href'); | |
$('html, body').animate({scrollTop: $(target).offset().top}, 1000); | |
return false; | |
}); | |
}); |
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
// СВОЙСТВА И АТРИБУТЫ: prop and attr | |
// ======================================= | |
// PROP - для disabled | |
// правильно | |
$("input").prop('disabled', true); | |
$("input").prop('disabled', false); | |
// не правильно! |
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
$scope.options = [ | |
{value:'Option1', selected:true}, | |
{value:'Option2', selected:false}, | |
{value:'Option3', selected:false}, | |
{value:'Option4', selected:false}, | |
{value:'Option5', selected:false}, | |
{value:'Option6', selected:false} | |
]; | |
$scope.toggleAll = 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 passGen(charsCount) { | |
var result = ''; | |
var words = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM'; | |
var max_position = words.length - 1, | |
position, | |
i; | |
for(i = 0; i < charsCount; ++i) { | |
position = Math.floor (Math.random() * max_position); | |
result = result + words.substring(position, position + 1); | |
} |
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
'use strict'; | |
var React = require('react-native'); | |
var { | |
Bundler, | |
StyleSheet, | |
Text, | |
TouchableHighlight, | |
View, | |
ScrollView, |
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
Disclaimer: The instructions are the collective efforts from a few places online. | |
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
First off, bundle. | |
================== | |
1. cd to the project directory | |
2. Start the react-native packager if not started | |
3. Download the bundle to the asset folder: | |
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
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 districts = []; | |
function removeDuplicateDistricts(cities) { | |
for (let i = 0; i < cities.length; i++) { | |
if (districts.length === 0) { | |
districts.push(cities[0]); | |
} else { | |
var uniqueDistrict = true; | |
districts.forEach(function(dist) { | |
if (cities[i].Region == dist.Region && cities[i].District == dist.District) { | |
uniqueDistrict = false; |
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
// Чтобы git не конвертировал переносы строк автоматом в crlf в скачиваемых репозиториях, прописываем это комманду: | |
git config --global core.autocrlf false |
OlderNewer