Skip to content

Instantly share code, notes, and snippets.

View WebSofter's full-sized avatar
🌴
On vacation

David Amirkhanov WebSofter

🌴
On vacation
View GitHub Profile
@WebSofter
WebSofter / check_for_register.php
Created September 10, 2017 11:31
Joomla:PHP:User:Проверка на регистрацию пользователя #php #joomla
<div class="chat-message-form">
<?php
$user = JFactory::getUser();
if(in_array('2', $user->groups)) { // check for group with id: 2
?>
<form action="#">
<input class="chat-new-message" name="new-message" type="text" placeholder="Напишите сообщение" />
<button class="chat-send-message" id="mod-chat-btn" type="button"></button>
</form>
<?php
@WebSofter
WebSofter / get_current_username.php
Created September 10, 2017 12:21
Joomla:PHP:User:Получение логина пользователя #php #joomla
<form action="#">
<input type="hidden" name="Username" id="mod-chat-username" value="<?php echo JFactory::getUser()->get('username'); ?>">
<input class="chat-new-message" name="new-message" id="mod-chat-message" type="text" placeholder="Напишите сообщение" />
<button class="chat-send-message" id="mod-chat-btn" type="button"></button>
</form>
@WebSofter
WebSofter / script.php
Last active September 12, 2017 08:13
Joomla:PHP:Language:Получить свойство текущего языка #joomla #php #language
<?php
//Если работаем внутри модуля или компонента
echo JText::_('MOD_LOGIN_VALUE_USERNAME'); //Просто указываем название свойства и получаем занчение
?>
@WebSofter
WebSofter / script.php
Created September 12, 2017 14:25
PHP:DATETIME:Перевод количества секунд в формат времени #time #php
echo gmdate("H:i:s", 685);
@WebSofter
WebSofter / script.js
Last active October 3, 2017 05:25
jQueryUI:jQuery:AJAX: Datapicker в динамически подгружаемом дмалоге #jQueryUI #AJAX #JavaScript
$(document).ready(function(){
$( document.body ).on( 'click', '#datapicker', function() {
//alert("");
$(this).datepicker({showOn:'focus'}).focus();
});
}(jQuery));
@WebSofter
WebSofter / script.js
Last active October 3, 2017 06:39
jQueryUI:DatePicker:Ограничение выборки определенных дней #jQuery #DatePicker
/* *****************************Запретить определенные дни******************************* */
var disabledDays = ["1-10-2017","5-10-2017","10-10-2017","11-10-2017","15-10-2017","7-10-2017"];
/* utility functions */
function nationalDays(date) {
var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
//console.log('Checking (raw): ' + m + '-' + d + '-' + y);
for (i = 0; i < disabledDays.length; i++) {
if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1 || new Date() > date) {
//console.log('bad: ' + (m+1) + '-' + d + '-' + y + ' / ' + disabledDays[i]);
@WebSofter
WebSofter / bootstrap.css
Created October 14, 2017 21:45
Bootstrap 4.0
#Хедер
.navbar-header
.nav
.navbar-nav
#Контент
.container
.row
.col- [offset-]
.col-sm-[offset-]
.col-md-[offset-]
@WebSofter
WebSofter / script.js
Created November 3, 2017 13:13
Chrome hash link/anchor bag fixing
$("#menu-top-menu").find(".menu-item").click(function(){
var hash = $(this).find("a").attr("href").split("#")[1];
var hashNum = 0;
if (window.location.hash != ''){
hashNum = window.location.hash.replace("#"+hash, "");
console.log('hashNum: ' + hashNum);
};
hashMenu = jQuery("#"+hash).offset().top;
jQuery('html,body').animate({
scrollTop: hashMenu
@WebSofter
WebSofter / main.py
Created January 17, 2019 13:59
Get Element from another widget
class AnyWidgetObject(Popup):
def selected_file(self, *args):
super(AnyWidgetObject, self)
self.parent.children[1].ids.AnyElementId.text = "Hello World"
@WebSofter
WebSofter / List View in Kivy
Created January 17, 2019 15:38
List View in Kivy
class TextListView(StackLayout):
pass
#:kivy 1.10.1
# -*- coding: utf-8 -*-
#: import ListItemButton kivy.uix.listview.ListItemButton
#: import ListAdapter kivy.adapters.listadapter.ListAdapter
<TextListView>:
ListView:
adapter: ListAdapter(data = ['0','1','2','3','4','5','6','7','8','9'],