Skip to content

Instantly share code, notes, and snippets.

View nikartm's full-sized avatar
:electron:
Bio Robot

Ivan V nikartm

:electron:
Bio Robot
View GitHub Profile
@nikartm
nikartm / db_config.php
Created July 13, 2015 01:34
MySQL Data Base settings
<?php
define('DB_USER', "root"); //login DB
define('DB_PASSWORD', ""); // password DB
define('DB_DATABASE', "DataBaseName"); // name DB
define('DB_SERVER', "127.0.0.1"); // server IP
?>
@nikartm
nikartm / db_connect.php
Created July 13, 2015 01:35
Connect to DB MySQL
<?php
class DB_CONNECT {
function __construct() {
$this->connect();
}
function __destruct() {
$this->close();
@nikartm
nikartm / home.php
Last active October 12, 2015 20:46
Fish html page with news from site DB
<!doctype html>
<html>
<head>
<meta charset="utf8">
<title> Site news </title>
</head>
<body>
<div> <p>Спасибо за обращение! Ваше сообщение отправлено.</p> </div>
@nikartm
nikartm / functions.php
Created July 17, 2015 15:45
Template wordpress widget
// Создаем виджет BlogTool.ru
class btru_widget extends WP_Widget {
function __construct() {
parent::__construct(
// Выбираем ID для своего виджета
'btru_widget',
// Название виджета, показано в консоли
__('BlogTool Widget', 'btru_widget_domain'),
@nikartm
nikartm / accordeon.txt
Created July 24, 2015 17:35
jQuery Accordeon
JS:
$(".accordeon dd").hide().prev().click(function() {
$(this).parents(".accordeon").find("dd").not(this).slideUp().prev().removeClass("active");
$(this).next().not(":visible").slideDown().prev().addClass("active");
});
CSS:
.accordeon .active { color: red }
HTML:
@nikartm
nikartm / DatePHP
Created August 29, 2015 17:43
Print by php in the russian locale - date, month, week day and time
<?php
// Вывод даты на русском
$monthes = array(
1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля',
5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа',
9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря'
);
echo(date('d ') . $monthes[(date('n'))] . date(' Y, H:i'));
// Вывод дня недели
@nikartm
nikartm / JS_setTimeout
Created February 5, 2016 17:48
JS timeout for hover over an element
//Set timeout if hover over an element
$(document).ready(function() {
$('#slider').hover(
// if hover over an element
function(){
setTimeout(function() {
$('i.arrows').css({"opacity":"1"});
},
300);
@nikartm
nikartm / menu_hide.js
Created February 23, 2016 08:35
JS hide menu and open on click
//Hide products blocks
$(document).ready(function() {
$('.btn').click(function() { //Click on button
$(".cont").not(this).slideUp().prev().removeClass("active"); //Hide all open blocks
$(this).next().find(".cont").not(":visible").slideDown().prev().addClass("active"); //Open current block
});
});
<!-- Start products menu -->
<div class="container prod_block">
@nikartm
nikartm / Add new contact without confirmation
Last active November 18, 2016 11:41
Android add contact
try {
String DisplayName = "XYZ";
String MobileNumber = "123456";
String HomeNumber = "1111";
String WorkNumber = "2222";
String emailID = "email@nomail.com";
String company = "bad";
String jobTitle = "abcd";
ArrayList<ContentProviderOperation> ops = new ArrayList < ContentProviderOperation > ();
@nikartm
nikartm / ImgRedactor
Created January 13, 2017 11:26
Get bitmap shader circle img
// Get bitmap shader circle img
public static Bitmap getCircleMaskedBitmapShader(Bitmap source, int radius) {
if (source == null) { return null; }
int diam = radius << 1;
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Bitmap scaledBitmap = scaleTo(source, diam);
final Shader shader = new BitmapShader(scaledBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);