Skip to content

Instantly share code, notes, and snippets.

@ivanhub
ivanhub / git-откат
Created October 4, 2017 08:49
откат git
Полный откат до предыдущего коммита
git reset HEAD --hard
@ivanhub
ivanhub / Gists for SublimeText3
Created October 4, 2017 08:50 — forked from wpupru/Gists for SublimeText3
Настройка GitHub Gist в sublime text 3
Настройка GitHub Gist в sublime text 3
Первым делом нам нужно сгенерировать token.
Переходим на свой гитхаб, идем в settings и там в пункте Applications жмем Generate new token
Далее называем его как угодно и выбираем только один пункт gist и жмем генерировать.
Теперь устанавливаем полученный token в preferences => Package Settings => Gits => Settings-Default
Вторым пунктом, настраиваем комбинацию клавиш
Переходим preferences => Package Settings => Gits => Key Bindings-user
И изменяем как нам удобно, вот мой пример
@ivanhub
ivanhub / git_ignore
Last active April 10, 2019 13:57 — forked from wpupru/git_ignore
Git создание глобального игнора
git config --global core.excludesfile ~/.gitignore_global
--
Для начала создаем в любом месте вашей системы файл .gitignore_global (имя файла, как и его расположение также может быть абсолютно любым) и добавляем в него ресурсы, которые будут игнорироваться по-умолчанию, например вышеназванная папка .idea. Чтобы Git узнал о вашем намерении игнорировать эти ресурсы глобально, необходимо в командной строке запустить следующую команду:
git config --global core.excludesfile "/path/to/your/.gitignore_global"
Чтобы посмотреть список файлов, для которых включено глобальное игнорирование, достаточно запустить следующую команду:
git config --global core.excludesfile
@ivanhub
ivanhub / generate-token.sh
Created October 4, 2017 08:56
generate github token via curl
curl -v -u USERNAME -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"SublimeText 2/3 Gist plugin\"}"
#curl -v -u USERNAME -H "X-GitHub-OTP: OTPCODE" -X POST https://api.github.com/authorizations --data "{\"scopes\":[\"gist\"], \"note\": \"SublimeText 2/3 Gist plugin\"}"
@ivanhub
ivanhub / JS-YII2-where
Last active October 4, 2017 11:27
inline js YII2 where
<?php
$this->registerJs(<<<JS
JS
, yii\web\View::POS_READY);
?>
$this->registerJsFile('url/to/file.js', ['position' => yii\web\View::POS_END]);
Run "sudo visudo" to edit the sudoers file. Add the line "$USER ALL = (root) NOPASSWD: /usr/sbin/sshd -D", replacing "$USER" with your Linux username.
set ws=wscript.createobject("wscript.shell")
ws.run "C:\Windows\System32\bash.exe -c 'sudo /home/iv/start.sh'",0
/home/iv/start.sh:
sudo /etc/init.d/mysql start
@ivanhub
ivanhub / cors-test.html
Created November 2, 2017 04:24
CORS-test
<!DOCTYPE html>
<html>
<head>
<!--<script type="text/javascript" src="./functions.js"></script>
-->
</head>
<body>
<script type="text/javascript">
// Create the XHR object.
function createCORSRequest(method, url) {
@ivanhub
ivanhub / cors-yii2.controller
Created November 2, 2017 04:25
cors-yii2-configuration
public static function allowedDomains() {
return [
// '*', // star allows all domains
'http://ros.academy',
'https://ros.academy',
];
}
/**
* @inheritdoc
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3.
//
// This is a hack to fill the gap between 480 and 760 pixels - a missing range
// in the bootstrap responsive grid structure. Use these classes to style pages
// on cellphones when they transition from portrait to landscape.
//
// NOTE: Here I use SASS instead of LESS for styling. To convert to LESS
// replace '$screen' with '@screen' and '$grid' with '@grid'.
//
// See https://github.com/twbs/bootstrap/issues/10203 for more info.
.col-ms-1,
.col-ms-2,
.col-ms-3,
.col-ms-4,
.col-ms-5,
.col-ms-6,
.col-ms-7,
.col-ms-8,
.col-ms-9,
.col-ms-10,