Skip to content

Instantly share code, notes, and snippets.

View Defite's full-sized avatar
🚙

Nikita Makhov Defite

🚙
View GitHub Profile
@Defite
Defite / splitString.js
Created October 14, 2016 13:41 — forked from hendriklammers/splitString.js
Javascript: Split String into size based chunks
/**
* Split a string into chunks of the given size
* @param {String} string is the String to split
* @param {Number} size is the size you of the cuts
* @return {Array} an Array with the strings
*/
function splitString (string, size) {
var re = new RegExp('.{1,' + size + '}', 'g');
return string.match(re);
}
@Defite
Defite / content.js
Last active March 20, 2016 20:14 — forked from Lerg/index-content.js
Manual preview cut for {{content}} helper in Ghost platform
// ### Content Helper
//
// *Usage example:*
// `{{content}}`
// `{{content words="20"}}`
// `{{content characters="256"}}`
// `{{content preview="true"}}`
//
// Turns content html into a safestring so that the user doesn't have to
// escape it or tell handlebars to leave it alone with a triple-brace.
@Defite
Defite / highlight.js
Created March 19, 2016 06:04 — forked from jorgt/highlight.js
Hexo lib/utli/highlight.js without elements I don't need like tables and above all accepting standard highlightjs themes
/*
Adaption of Hexo's hexo\node_modules\hexo-util\lib\util\highlight.js
original code highlighter uses <figure> and <table>s as gutter. Had some validation issues. Also did not accept
standard higlightjs themes (https://github.com/isagalaev/highlight.js/tree/master/src/styles) which are now
just drop in.
captions still require a tiny bit of css of your own because they're not standard in highlightjs.
I'm accompanying this by a tiny JS that adds .hljs to every pre tag that doesn't contain it, so it applies to

Keybase proof

I hereby claim:

  • I am defite on github.
  • I am defite (https://keybase.io/defite) on keybase.
  • I have a public key whose fingerprint is 3D0F 94ED CE43 3998 15E8 21FF DF37 CB6F 407B C202

To claim this, I am signing this object:

@Defite
Defite / 0_reuse_code.js
Created January 21, 2016 17:43
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
@Defite
Defite / highlight
Created April 29, 2015 13:15
highlight
/* Comment */
.highlight .err {
color: #960050;
background-color: #1e0010;
}
/* Error */
.highlight .k {
color: #66d9ef;
}
digitHelper: function(digit) {
return digit.toString().replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1&thinsp;');
}
/* Методы jQuery .bind(), .live(), и .delegate() пишутся с использованием введеного в jQuery 1.7 метода .on() */
// Bind
$( "#members li a" ).on( "click", function( e ) {} );
$( "#members li a" ).bind( "click", function( e ) {} );
// Live
$( document ).on( "click", "#members li a", function( e ) {} );
$( "#members li a" ).live( "click", function( e ) {} );
<div class="accordion" id="accordion2">
<?php
//get all children of category "General", then display posts in each cat
$taxonomy = 'category';
$param_type = 'category__in';
$cat_id = get_cat_ID('General');
$term_args=array(
'orderby' => 'name',
'order' => 'ASC',
@Defite
Defite / css3 block with arrow and shadows
Created June 1, 2013 14:05
css3 block with left arrow and shadows
<style>
.b-map-popup {
position: relative;
background: #fefefe;
border: 1px solid #fefefe;
-webkit-border-radius:4px;
border-radius:4px;
-webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.3);
z-index:100;