Skip to content

Instantly share code, notes, and snippets.

View kossoff's full-sized avatar

Anthony kossoff

View GitHub Profile

Sublime FAQ

Множественное выделение

Sublime предоставляет массу возможностей для множественного выделения и правки, т.е. можно установить курсор сразу в несколько мест и править код синхронно (при этом будут работать макросы, autocomplete, snippet-ы, буфер обмена и т.д.). Установить новую позицию курсора можно через ctrl + left_mouse_click. Или ctrl + left_double/_triple click (выделит слово/абзац целиком).

Fuzzy Search

  • Ctrl + P— поиск по файлам проекта
  • Ctrl + R — поиск по функциям (по template-ам в XSLT, селекторам в CSS/SCSS и т.д.)
@kossoff
kossoff / dnsmasq.sh
Created October 31, 2014 13:47
Script for add & remove fake domains in Dnsmasq
#!/bin/sh
HOSTS="$HOME/Work/dnsmasq.hosts"
if [ $# == 2 ] || [ $# == 3 ]; then
case $# in
2 )
echo Remove $2 from hosts
sed '/$2/d' $HOSTS
;;
@kossoff
kossoff / changePGTableUsers.sh
Last active August 29, 2015 14:08
Change owner to all tables in PostgreSQL database
#!/bin/sh
dbname=$1
dbuser1=$2
dbuser2=$3
for TABLE in `psql ${dbname} -U ${dbuser1} -c "\dt *.*"|grep ${dbuser1}|cut -f 3` ;
do
psql -U ${dbuser1} -c "ALTER TABLE ${TABLE} OWNER to ${dbuser2}";
done
@kossoff
kossoff / material_design_colors.scss
Last active November 30, 2015 05:46
Material Design color variables for SCSS
// Material Design Colors for SCSS
// https://www.google.com/design/spec/style/color.html#color-color-palette
// Main colors
$red: #F44336;
$pink: #E91E63;
$purple: #9C27B0;
$deep-purple: #673AB7;
/*
Zurb Foundation Accordion:
<dl class="accordion" data-accordion>
<dd class="accordion-navigation">
<a href="#panel1b"><i class="fi-plus">&nbsp;Accordion 1</a>
<div id="panel1b" class="content">
Panel 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
</dd>
</dl>
@kossoff
kossoff / index
Last active August 29, 2015 14:16
Disable right click & context menu for page
<body oncontextmenu="return false">
...
<script>
document.onmousedown=disableclick;
function disableclick ( event ) {
if ( event.button == 2 ) { return false; }
};
</script>
@kossoff
kossoff / update_price_by_currency_rate.php
Created September 22, 2015 18:26
Для Drupal 7. Меняем значение поля price_ru в соответсвии с курсом евро с сайта ЦБ РФ. Исходная цена = price_eu
<?php
header('Content-Type: text/html; charset=UTF-8');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
@kossoff
kossoff / update_price_by_csv.php
Created September 22, 2015 18:34
Drupal 7. Обновление/добавление цен для товаров из CSV-файла. Ключ - уникальный title.
<?php
header('Content-Type: text/html; charset=UTF-8');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Exorcizo te, immundissime spiritus, omnis incursio adversarii, omne phantasma, omnis legio, in nomine Domini nostri Jesu Christi eradicare, et effugare ab hoc plasmate Dei. Ipse tibi imperat, qui te de supernis caelorum in inferiora terrae demergi praecepit. Ipse tibi imperat, qui mari, ventis, et tempestatibus impersvit. Audi ergo, et time, satana, inimice fidei, hostis generis humani, mortis adductor, vitae raptor, justitiae declinator, malorum radix, fomes vitiorum, seductor hominum, proditor gentium, incitator invidiae, origo avaritiae, causa discordiae, excitator dolorum: quid stas, et resistis, cum scias. Christum Dominum vias tuas perdere? Illum metue, qui in Isaac immolatus est, in joseph venumdatus, in sgno occisus, in homine cruci- fixus, deinde inferni triumphator fuit. Sequentes cruces fiant in fronte obsessi. Recede ergo in nomine Patris et Filii, et Spiritus Sancti: da locum Spiritui Sancto, per hoc signum sanctae Cruci Jesu Christi Domini nostri: Qui cum Patre et eodem Spiritu Sancto vivit et r
require 'rubygems'
require "net/http"
require "net/https"
require 'nokogiri'
XML = Nokogiri::HTML open "sitemap.xml"
links = XML.css "loc"
links.each do |link|
uri = URI link.text