Skip to content

Instantly share code, notes, and snippets.

@morsvox
morsvox / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@morsvox
morsvox / javascript_resources.md
Last active August 29, 2015 14:07 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@morsvox
morsvox / css_resources.md
Last active August 29, 2015 14:07 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@morsvox
morsvox / Битрикс - сообщение о применении скидки на доставку
Last active August 29, 2015 14:07
Битрикс: Выводим сообщение о скидке на доставку
$sale = CSaleDiscount::GetByID(4);
//Получаем позициюБольше либо равно в условии
$str = strripos($sale['UNPACK'], '>=');
//Обрезаем до этой позиции
$resPres = substr($sale['UNPACK'], $str+3);
//Получаем цифру для сравнения
$thisPrice = intval($resPres);
@morsvox
morsvox / gist:5e587a3290f3c226d638
Created November 19, 2014 12:39
validation js + bitrix + ajax
$('form[name="faq-ui-dialog"] input[type="submit"]').click(function(){
var Error = false,
ErrorList = '';
Captcha = $('form[name="faq-ui-dialog"] input[name="captcha_word"]').val();
if($('form[name="faq-ui-dialog"] input[name="PHONE"]').val() == '' ){
Error=true;
ErrorList+='Вы не ввели телефон или ввели его не верно!<br/>';
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Take pictures from your webcam</title>
</head>
<body>
<div class="booth">
<video id="video" width="400" height="300" autoplay></video>
<a href="#" id="capture" class="booth-capture-button">Сфотографировать</a>
Если файлы только добавлены, но еще не включены в коммит
В данном конкретном случае именно так и есть. При этом достаточно удалить их из индекса. Данная команда возвращает индекс к HEAD, то есть состоянию последнего коммита.
git reset <file-name>
Вы можете заметить, что сам Git предлагает использовать другую команду:
git rm --cached <file-name>
В данном случае эти команды эквивалентны. Такое дублирование появилось в результате эволюционного развития функционала Git. Это в том числе отражено в документации и в сообщениях Git: где-то рекомендуется reset, где-то rm --cached.
@morsvox
morsvox / bitrix.sh
Created November 2, 2017 10:45
bash script for bitrix optim
#!/bin/sh
cd $HOME/public_html/local/templates/oknapolis
gulp
echo "upload optimize"
cd $HOME/public_html/upload/
find -type f -iname "*.jpg" -exec jpegoptim --strip-all --all-progressive -pm85 {} \;
echo "build optimize"
cd $HOME/public_html/local/templates/oknapolis/build/images/
find -type f -iname "*.jpg" -exec jpegoptim --strip-all --all-progressive -pm85 {} \;
@morsvox
morsvox / script.sh
Created November 23, 2017 07:00
grep поиск и замена в папке ./* (все файлы в текущей папке)
grep -rl 'то_что_ищем' ./* | xargs perl -p -i -e 's/то_что_ищем/то_на_что_заменяем/g'