Skip to content

Instantly share code, notes, and snippets.

View nekitozzz's full-sized avatar
🌏
Working from home

Nikita Anisimov nekitozzz

🌏
Working from home
  • Tbilisi, Georgia
View GitHub Profile
@nekitozzz
nekitozzz / SelectAllCheckbox.js
Created August 25, 2015 12:05
Select/deselect all checkboxes using jQuery
var checkboxList = this.$el.find('.b-filter-dialog__params').filter(':has(.selectall)');
checkboxList.each((index, element) => {
var $element = $(element);
var allCheckbox = $element.find('.selectall');
var regularCheckboxes = $element.find(':checkbox').not('.selectall');
allCheckbox.click(function() {
regularCheckboxes.attr('checked', this.checked);
});
@nekitozzz
nekitozzz / less for sprites.less
Last active August 29, 2015 14:20
less for sprites
// SPRITES
// All icons receive the styles of the <i> tag with a base class
// of .i and are then given a unique class to add width, height,
// and background-position. Your resulting HTML will look like
// <i class="icon-inbox"></i>.
// For the white version of the icons, just add the .icon-white class:
// <i class="icon-inbox icon-white"></i>
[class^="icon-"],
@nekitozzz
nekitozzz / Number of style selectors on page.js
Last active April 18, 2016 10:44
Number of style selectors on page
var
styleSheets = document.styleSheets,
totalStyleSheets = styleSheets.length,
totalRules = 0;
for (var j = 0; j < totalStyleSheets; j++){
var
styleSheet = styleSheets[j],
rules = styleSheet.cssRules,
totalRulesInStylesheet = rules.length,
@nekitozzz
nekitozzz / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-profile.html">
<polymer-element name="my-element">
<template>
<style>
#topeka_profile {
width: 300px;
height: 300px;
@nekitozzz
nekitozzz / FullTextIndexingIsDone.sql
Last active August 29, 2015 14:13
True if FullTex indexing of database is done
CREATE FUNCTION [dbo].[is_fulltext_indexed]()
RETURNS BIT
AS
BEGIN
RETURN
CASE
WHEN (SELECT COUNT(*) FROM
(SELECT
FULLTEXTCATALOGPROPERTY(fc.[name],'PopulateStatus') AS PopulateStatus
FROM sys.fulltext_catalogs fc) t
@nekitozzz
nekitozzz / Fields formating.cs
Last active August 29, 2015 14:10
Fields formating
public string FirstName { get; set; } => public string FirstName { get; set; }
public string Surname { get; set; } => public string Surname { get; set; }
public int Age { get; private set; } => public int Age { get; private set; }
private Address Address { get; set; } => private Address Address { get; set; }
@nekitozzz
nekitozzz / InvoiceModelJavaScriptConverter.cs
Created October 15, 2014 11:17
Map json object to .Net model using JavaScriptConverter
public class InvoiceModelJavaScriptConverter : JavaScriptConverter
{
public override object Deserialize(IDictionary<string, object> dictionary, Type type,
JavaScriptSerializer serializer)
{
var members = new List<MemberInfo>();
members.AddRange(type.GetFields());
members.AddRange(
type.GetProperties().Where(p => p.CanRead && p.CanWrite && p.GetIndexParameters().Length == 0));
@nekitozzz
nekitozzz / Iterate by properties.cs
Last active August 29, 2015 14:05
Iterate by properties C# using reflection
//Выбираем все строки, в которых содержатся хоть какие-то данные
var nonEmptyItems =
items.Where(
i => i.GetType()
.GetProperties()
.Any(p => !string.IsNullOrWhiteSpace(p.GetValue(i) as string)))
.ToList();