Skip to content

Instantly share code, notes, and snippets.

View bu1ka's full-sized avatar

Alexey Solomentsev bu1ka

  • Russia, Moscow
View GitHub Profile
#!/bin/bash
is_package_json_at_git_index() {
package_json_changed=$(git diff --cached --name-only | grep -x package.json 2> /dev/null)
if [ "$package_json_changed" ];
then
return 0;
else
return 1;
fi
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.label {
display: block;
padding: 10px;
@bu1ka
bu1ka / 0_reuse_code.js
Created July 8, 2016 12:47
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
@bu1ka
bu1ka / gist:50ce7fe1fd49c834d126
Created November 11, 2015 14:09
Best sorting algorithm
Array.prototype.sort = function() {
'use strict';
var length = this.length;
this.forEach(function(el, i) {
var min = i + 1;
var max = length - min;
var newIndex = Math.floor(Math.random() * (max - min + 1)) + min;
var Engines = Backbone.Collection.extend({
model: FilterItem,
initialize: function() {
this.on('change:selected', this.toggleSelected, this);
},
toggleSelected: function(model) {
if (model.changed.selected) {
this.without(model).forEach(function(unSelectedModel) {
unSelectedModel.set('selected', false);
});