Skip to content

Instantly share code, notes, and snippets.

View RinatMullayanov's full-sized avatar

Rinat Mullayanov RinatMullayanov

View GitHub Profile
@RinatMullayanov
RinatMullayanov / bem-naming.css
Last active August 29, 2015 14:19
BEM naming in CSS and HTML
.some-block {} /*block*/
.some-block__element {} /*element*/
.some-block_size_large {} /*modificator of block*/
.some-block__element_size_large {} /*modificator of element*/
/*
Block may contains another blocks and elements.
Element may contains another blocks and elements.
*/
var Circle = function() {};
Circle.prototype = {
area: function() {
return Math.PI * this.radius * this.radius;
},
grow: function() {
this.radius++;
},
shrink: function() {
this.radius--;
@RinatMullayanov
RinatMullayanov / 1_ruby_quicksort.rb
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
# Use Gists to store entire functions
class QuickSort
def self.sort!(keys)
quick(keys,0,keys.size-1)
end
private
def self.quick(keys, left, right)
Eric Schoffstall https://github.com/contra author Gulp.js
@RinatMullayanov
RinatMullayanov / gulpfile.js
Last active August 29, 2015 14:07
Sample gulpfile.js with using express
var gulp = require('gulp'),
compass = require('gulp-compass'),
express = require('express'),
gutil = require('gulp-util'),
path = require('path'),
refresh = require('gulp-livereload'),
server = require('tiny-lr')();
gulp.task('expressServer', function(){
app = express();
@RinatMullayanov
RinatMullayanov / new settings.xml
Created September 25, 2014 19:11
like .jshintrc for visual studio 2012 extension
<?xml version="1.0"?>
<Options xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Enabled>true</Enabled>
<ErrorCategory>Error</ErrorCategory>
<TODOEnabled>false</TODOEnabled>
<TODOCategory>Task</TODOCategory>
<RunOnBuild>true</RunOnBuild>
<CancelBuildOnError>true</CancelBuildOnError>
<JSLintOptions>
<BoolOptions2>
#!/bin/bash
# Pre-commit Git hook to run JSHint on JavaScript files.
#
# If you absolutely must commit without testing,
# use: git commit --no-verify
filenames=($(git diff --cached --name-only HEAD))
which jshint &> /dev/null
if [ $? -ne 0 ];
@RinatMullayanov
RinatMullayanov / .jshintrc
Created September 25, 2014 16:51
jshintrc for nodejs - clear - without comments
{
"boss": true,
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
@RinatMullayanov
RinatMullayanov / .jshintrc
Last active August 29, 2015 14:06
My .jshintrc with comments
{
//[twitter] https://github.com/twitter/plumage.js/blob/master/.jshintrc
"boss": true,
"node": true, //глобальные переменные node
"browser": true, //глобальные переменные современных браузеров
"esnext": true, //говорит что код использует фишки следующей спецификации JS(в нашем случае EcmaScript 6)
"bitwise": true, //запрещает использовать побитовые операции ^(XOR) и I(OR)
"curly": true, //везде фигурные скобки
"eqeqeq": true, //везде строгое сравнение - ===
"immed": true, //обязывает оборачивать моментально вызываемые функции в скобки
@RinatMullayanov
RinatMullayanov / modern_inheritance.js
Created August 28, 2014 08:32
Sample modern prototype inheritance in Javacript
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
function Product(name, price) {
this.name = name;
this.price = price;
if (price < 0)
throw RangeError('Cannot create product ' +
name + ' with a negative price');
return this;
}