Skip to content

Instantly share code, notes, and snippets.

function Drag() {
var that = this;
this.positEl = function(pos) {
pos.el.style.left = pos.left + 'px';
pos.el.style.top = pos.top + 'px';
pos.el.style.right = 'auto';
pos.el.style.bottom = 'auto';
}
this.on = function(element, style, callback) {
/*
@SergProduction
SergProduction / parseElectroPara.js
Last active November 7, 2016 11:57
go to link http://electropara.ru/catalog/lampy/, 2.copy code 3.paste in console -> enter. 4. write in console start() -> enter
"use strict";function exportTableToCSV(t,e){function n(t){return t.get().join(l).split(l).join(f).split(d).join(c)}function o(t,e){var n=$(e),o=n.find("td");return o.length||(o=n.find("th")),o.map(a).get().join(d)}function a(t,e){var n=$(e),o=n.text();return o.replace('"','""')}var r=t.find("tr:has(th)"),i=t.find("tr:has(td)"),d=String.fromCharCode(11),l=String.fromCharCode(0),c='";"',f='"\r\n"',h='"';h+=n(r.map(o)),h+=f,h+=n(i.map(o))+'"';var s="data:application/csv;charset=utf-8,"+encodeURIComponent(h);return{name:e+".csv",href:s}}function stop(){_$stop=!0}function start(){function t(e){function o(o){if("ready"==o){var r=exportTableToCSV($(a[e].document).find("#dvData table"),n[e].name);n[e].tag.href=r.href,n[e].tag.setAttribute("download",r.name),n[e].tag.style.color="green",t(e+1)}else n[e].procent.textContent=o+"%",console.log(o)}_$stop||e>=n.length||(a[e]=window.open(n[e].link,n[e].name,"width=600,height=600,scrollbars=yes,resizable=yes,"),a[e].onload=function(){parsePage(a[e],o)})}var e=new Date;e=Stri
var JSONfn = {};
JSONfn.stringify = function (obj) {
return JSON.stringify(obj, function (key, value) {
var fnBody;
if (value instanceof Function || typeof value == 'function') {
fnBody = value.toString();
if (fnBody.length < 8 || fnBody.substring(0, 8) !== 'function') { //this is ES6 Arrow Function
return '_NuFrRa_' + fnBody;
}
return fnBody;
var _help = {},
_helpEl = {};
_helpEl.temp = {};
_helpEl.temp.parent = [];
_helpEl.temp.queue = [];
_helpEl.temp.count = 0;
_helpEl.temp.style = {};
_helpEl.temp.size = {};
_helpEl.temp.wrap;
import React, {Component} from 'react';
import { connect } from 'react-redux';
function mapDispatchToProps(dispatch){
return {
action: (x) => {
dispatch(x)
},
}
}
// README and npm module https://www.npmjs.com/package/date-template
/**
*@function
*@name dateTemplate
*@param {string} format - ~Y~ ~M~ ~Dw~ ~D~ ~h~ ~m~ ~s~ ~mm~
*@param {number} oldDate - milliseconds time OR Date object
*@param {function} middleware - Change the date type
*/
const dateTemplate = function( format, oldDate, middleware ){
let date = oldDate ? new Date(oldDate) : new Date();
<div id="quest">
<input type="text"/>
<button>Спросить</button>
</div>
'use strict';
var tools = (function(){ //инструменты
var setCookie = function(name, value, expires, path, domain, secure) {
var expdate = new Date(); //Создаем объект даты
var monthFromNow = expdate.getTime() + (60 * 24 * 60 * 60 * 1000);
expdate.setTime(monthFromNow); //Устанавливаем значение даты
document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "; expires=" + expdate.toGMTString()) + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
};
var getCookie = function (c_name) {
const Emitter = () => {
let store = []
let subscribe = ( name, fn ) => {
store.push({name, fn})
return () => {
store = store.find( el => el.name != name);
}
}
let publish = ( name, data) => store.forEach( obj =>{
if(obj.name == name) obj.fn( data )
//добавляем svg тег в body
var svg = d3.select("body").append("svg");
svg.attr("height", 600)
.attr("width", 600)
.style('border','1px solid')
var data = [
{x: 80, y: 100},{x: 120, y: 100},
{x: 240, y: 200},{x: 280, y: 200}