Skip to content

Instantly share code, notes, and snippets.

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

Aleksey Svechkar asvechkar

🏠
Working from home
  • FRESH INTEL
  • Dubai
View GitHub Profile

Есть набор данных (КЛАДР):

var data = [

   { region: 1, city: 0, street:0, name: "Ростовская обл.", type: 1 },
   { region: 2, city: 0, street:0, name: "Ленинградская обл.", type: 1 },
   { region: 3, city: 0, street:0, name: "Магаданская обл.", type: 1 },

/** ... **/

@asvechkar
asvechkar / postgres.sql
Created March 22, 2014 12:17
Postgresql commands
sudo -u postgres psql
CREATE DATABASE test_database;
CREATE USER test_user WITH password 'qwerty';
GRANT ALL privileges ON DATABASE test_database TO test_user;
psql -h localhost test_database test_user
@asvechkar
asvechkar / jquery_10_tricks.js
Created February 6, 2014 19:32
10+ полезных jQuery сниппетов на каждый день
// Плавный скролл к верху страницы
$("a[href='#top']").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
// Дублирование thead в самый низ html таблицы
var $tfoot = $('<tfoot></tfoot>');
$($('thead').clone(true, true).children().get().reverse()).each(function() {
$tfoot.append($(this));
@asvechkar
asvechkar / wp_tips_tricks.php
Last active December 29, 2015 04:49
Powerful WordPress Tips And Tricks
<?php
/* Replace Built-In Scripts By Deregistering Them */
function my_scripts_method() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', get_template_directory_uri() . '/js/jquery-new.js');
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'my_scripts_method');
/* Force Perfect JPG Images */
@asvechkar
asvechkar / install_google_chrome.sh
Created October 18, 2013 14:38
Install Google Chrome to Ubuntu
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get update
sudo apt-get install google-chrome-stable
@asvechkar
asvechkar / frontendtools.md
Created October 5, 2013 22:23
Полезные ссылка для фронтэнда

#Landscaping With Frontend Development Tools

An opinionated list of tools for frontend (i.e. html, js, css) desktop/laptop (i.e. does not include tablet or phone yet) web development

##Coding Tools

######Workflow/Builds/Assemblers

@asvechkar
asvechkar / regexp.rb
Last active December 22, 2015 13:19
регулярные выражения
# Matching a Username
/^[a-z0-9_-]{3,16}$/
# Matching a Password
/^[a-z0-9_-]{6,18}$/
# Matching a Hex Value
/^#?([a-f0-9]{6}|[a-f0-9]{3})$/
# Matching a Slug
/^[a-z0-9-]+$/
# Matching an Email
/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
@asvechkar
asvechkar / devise_helper.rb
Created September 5, 2013 14:07
Верстка ошибок Devise в формах
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
html = <<-HTML