Skip to content

Instantly share code, notes, and snippets.

View shershen08's full-sized avatar

Mikhail Kuznetcov shershen08

View GitHub Profile
// Movable grid line
// ------------------
// remove on dblclick, several lines possible
jQuery('<div/>').prependTo('body')
.css({"position":"absolute","width": 1,"height":jQuery('body').css('height'),"background":"#f00","left":30,"z-index":10000, 'cursor':'pointer'})
.dblclick(function() {jQuery(this).remove();})
.hover(function(){
var lineId = (new Date()).getTime().toString().substr(8);
jQuery(this).addClass('grid-line').attr('id', 'grid'+lineId).css({"width": 2});
@shershen08
shershen08 / gist:edab3da7a932f6f94741
Created January 22, 2015 20:59
console parsing of page Книжный топ–лист D3
//for page https://library.d3.ru/comments/613787/
var allNodes = document.querySelectorAll('.c_body b'), result = [];
function getBooksWithRating(item,i) {
var newItem = {}, rate;
newItem.text = item.innerHTML;
rate = item.parentNode.parentNode.querySelectorAll('.vote_result')[0] ? item.parentNode.parentNode.querySelectorAll('.vote_result')[0].innerHTML : 0;
newItem.rating = rate;
if(rate > 30){
result.push(newItem);
}
@shershen08
shershen08 / gist:230de56763a75a7daabf
Created May 4, 2015 14:18
sample json generates 400
{"data":{"id":null,"primaryRoleId":66,"roleId":66,"type":"subjects","fields":[{"id":"282","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":null}]},{"id":"292","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":"EUR11111"}]},{"id":"2","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":"22222"}]},{"id":"5","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":"A"}]},{"id":"3","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":"33333"}]},{"id":"294","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":null}]},{"id":"4","type":"fields","subjectfields":[{"id":null,"type":"subjectfields","value":null}]}]},"included":[],"meta":{"apiversion":"1.0.0","language":"en_EN","self":""}}
This file has been truncated, but you can view the full file.
Raphael.registerFont({"w":200,"face":{"font-family":"FreeSans","font-weight":400,"font-stretch":"normal","units-per-em":"360","panose-1":"2 11 5 4 2 2 2 2 2 4","ascent":"288","descent":"-72","x-height":"8","bbox":"-563 -648 674 432","underline-thickness":"18","underline-position":"-54.36","unicode-range":"U+0020-U+FFFD"},"glyphs":{" ":{"w":100},"\u0132":{"d":"126,-84v-3,37,6,65,40,64v32,0,39,-25,40,-58r0,-184r33,0r0,196v0,45,-29,74,-74,74v-53,0,-78,-34,-73,-92r34,0xm70,-262r0,262r-34,0r0,-262r34,0","w":266},"\u0133":{"d":"52,52v20,4,31,-4,31,-25r0,-216r30,0r0,228v2,29,-26,43,-61,38r0,-25xm113,-262r0,37r-30,0r0,-37r30,0xm54,-189r0,189r-30,0r0,-189r30,0xm54,-262r0,37r-30,0r0,-37r30,0","w":138},"\ufb00":{"d":"110,-189v-6,-49,12,-85,61,-73r0,25v-32,-6,-33,18,-31,48r31,0r0,25r-31,0r0,164r-30,0r0,-164r-48,0r0,164r-30,0r0,-164r-26,0r0,-25r26,0v-7,-50,12,-85,61,-73r0,25v-32,-6,-33,18,-31,48r48,0","w":178,"k":{"e":9,"\u00e8":9,"\u00e9":9,"\u00ea":9,"\u00eb":9,"\u00f0":9,"\u0113":9,"\u0115":9,"a":7,"g":7,"\u00e0":7,"\u
@shershen08
shershen08 / cli-rss-reader.js
Created March 5, 2016 10:19
A simple RSS Reader with Readline in NodeJS
/*
Readline module is used to read and write data in console.
Full docs on Readline - https: //nodejs.org/api/readline.html
In this example the list of RSS channes from Yandex.news - https: //news.yandex.ru/export.html
To call the script you should use type: 'node --harmony cmd.js'
*/
// Adding needed modules:
// readline - reads console ine
// request - does http resquests
@shershen08
shershen08 / angular-masonry-deps.js
Created May 6, 2016 12:21
Single module for including all angular-masonry dependences via AMD
/**
* Single module for including angular-masonry via AMD (e.g. RequireJS)
* includes: Bridget, matchesSelector, EvEmitter, Fizzy UI utils, getSize, imagesLoaded, Outlayer, Outlayer Item, Masonry
*
* Created at: 6-05-2016
* Created by: michail.kuznetsov@gmail.com
*/
define(['jquery'], function($) {
/**
@shershen08
shershen08 / fb-login.js
Created May 14, 2016 12:32
fb login boilerpale
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
console.log(response);
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {