Skip to content

Instantly share code, notes, and snippets.

View pwnz22's full-sized avatar
🏠
Working from home

Valijon pwnz22

🏠
Working from home
  • Dushanbe, Tajikistan
View GitHub Profile
@pwnz22
pwnz22 / send_email
Created February 2, 2018 12:35
Send email to AD users
###Модуль для обращения к AD
import-module activedirectory
import-module New-SWRandomPassword
###Модуль, который при запуске скрипта спрашивает имя пользователя(логин), у которого должен поменяться пароль
###$userset = Read-Host "Введите название группы:"
$userset = "All-Users"
###массив, в котором храняться логины пользователей(меняем SMS на название вашей ГРУППЫ из AD)
@pwnz22
pwnz22 / app.js
Created October 29, 2016 15:56
jQuery File Upload
var fileInput = $('input[type=file]'),
button = $('#upload');
button.on('click', function(){
// Access the files property, which holds
// an array with the selected files
var files = fileInput.prop('files');
// No file was chosen!
if(files.length == 0) {
alert('Please choose a file to upload!');
return false;
@pwnz22
pwnz22 / app.js
Created October 28, 2016 20:17
prevent text from being selectable
$('p.descr').attr('unselectable', 'on')
.css('user-select', 'none')
.on('selectstart', false);
@pwnz22
pwnz22 / app.js
Created October 28, 2016 20:10
Prevent "contextmenu"
$(function(){
$(document).on("",function(e){
e.preventDefault();
});
});
@pwnz22
pwnz22 / task.php
Created September 3, 2016 13:43
better variant
<?php
function human_plural_form($number, $titles = array('комментарий', 'комментария', 'комментариев'))
{
$cases = array(2, 0, 1, 1, 1, 2);
return $number . " " . $titles[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]];
}
var start = new Date();
for (var i = 0; i < 10000000; i++) var test = head.glasses;
alert(new Date() - start);
var start = new Date();
for (var i = 0; i < 10000000; i++) var test = pockets.glasses;
alert(new Date() - start);
@pwnz22
pwnz22 / common.js
Created June 10, 2016 10:50
price-range-ui-slider
// price range
jQuery('#slider-range').slider({
range: true,
min: 0,
max: 3500,
values: [ 100, 500 ],
slide: function( event, ui ) {
jQuery('#from').val( String(ui.values[0]).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 '));
jQuery('#to').val( String(ui.values[1]).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 '));
jQuery('.left_val').html( String(ui.values[0]).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 '));
@pwnz22
pwnz22 / common.js
Created June 10, 2016 10:48
showmore
jQuery('.products_wrapper .content_product:lt(4)').show();
var items = 8;
var shown = 4;
jQuery('#loadMore').click(function (event) {
event.preventDefault();
shown = jQuery('.products_wrapper .content_product:visible').size()+5;
if(shown< items) {
jQuery('.products_wrapper .content_product:lt('+shown+')').show();
} else {