Skip to content

Instantly share code, notes, and snippets.

View andreychev's full-sized avatar
🎯
Focusing

Philipp Andreychev andreychev

🎯
Focusing
View GitHub Profile
@andreychev
andreychev / detectIPadVersion.js
Created July 21, 2012 15:33
Функция для определия модели Айпеда.
// функция для определения модели Айпада
function detectIPadVersion(callback, undefined) {
if ('ondevicemotion' in window) {
window.addEventListener('devicemotion', function self(event) {
if (~navigator.platform.indexOf('iPad')) {
var version = event.acceleration ? (window.devicePixelRatio === 2) + 2 : 1;
}
window.removeEventListener('devicemotion', self);
callback(version);
@andreychev
andreychev / gist:3523188
Created August 30, 2012 06:17
Boilerplate console
// Avoid `console` errors in browsers that lack a console.
if (!(window.console && console.log)) {
(function() {
var noop = function() {};
var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
var length = methods.length;
var console = window.console = {};
while (length--) {
console[methods[length]] = noop;
}
@andreychev
andreychev / gist:3523280
Created August 30, 2012 06:26
Write javascript library
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.0.min.js"><\/script>')</script>
@andreychev
andreychev / .gitconfig
Created September 5, 2013 11:10
git_aliases
[user]
name = Philipp Andreychev
[core]
editor = vim
[alias]
unstage = reset HEAD --
co = checkout
br = branch
ci = commit
stat = status
@andreychev
andreychev / activity.js
Last active December 23, 2015 17:39
default_format
events: {
'click .b-header-notification_button': 'setLayout',
'hover .b-right_menu-item': 'showPopup',
'mouseleave .b-right_menu-item': 'hidePopup',
'click .b-right_menu-link': 'setOpened',
'click .b-right_menu-link': 'selectEl'
},
events: {
'click .b-header-notification_button': 'setLayout',
{
"directory": "scripts/bower"
}
@andreychev
andreychev / popup_edit_form.js
Created October 16, 2013 12:12
initSaveOnEnter
initSaveOnEnter: function() {
this.popup
.off('keyup.saveOnEnter')
.on('keyup.saveOnEnter', function(event) {
var target = event.target,
targetEl = $(target);
if (event.which == 13 && target.tagName != 'TEXTAREA' && !targetEl.hasClass('ui-autocomplete-input') && !targetEl.hasClass('js-save_on_enter')) {
this.popup
.find('.js-submit_button')
@andreychev
andreychev / precommit-hook
Created October 24, 2013 10:38
precommit-hook
#!/bin/sh
echo "\nStarting Grunt tests"
# Lint catalog js files with grunt.js
grunt catalog
RETVAL=$?
[ $RETVAL -eq 0 ] && echo Success
[ $RETVAL -ne 0 ] && echo Failure
@andreychev
andreychev / capitel.css
Last active December 28, 2015 02:39
Capitel
.smallcapitals {
font-size: 0.875em;
letter-spacing: 0.15em;
margin-right: -0.15em;
}
.classiccapitals {
font-variant: small-caps;
}
@andreychev
andreychev / mudrost.rb
Last active August 29, 2015 13:57
Мудрость общения в Скайпе или других мессенджерах
if skype.dispute.length >= 10.minutes
call(participants)
end