Skip to content

Instantly share code, notes, and snippets.

var r = new XMLHttpRequest(),
url = "https://dev28-lora-loreal.demandware.net/on/demandware.store/Sites-Site/default/SiteNavigationBar-ShowMenuitemOverview?CurrentMenuItemId=customers&itemType=Site";
setInterval(function(){
r.open("GET", url, true);
r.onreadystatechange = function () {
if (r.readyState != 4 || r.status != 200) return;
var date = new Date();
console.log(date.getHours() + ':' + date.getMinutes(),'session extended');
};
r.send("banana=yellow");
/**
* Create a project copy
*/
exports.clone = function(req, res) {
var project = req.project.toObject(),
title = project.title,
prefix = 'Копия ',
postfix = '',
copyTitle = title.indexOf(prefix) === 0 ? title.replace(/ \(\d+\)$/,'') : prefix + title,
titlePattern = new RegExp('^' + escape(copyTitle) + '( \\(\\d+\\))?$'),
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function TextPattern(pattern){
// type your offers.xml path
var xmlUrlOrPath = @"D:\Work\parfumstudio\Exchange\offers_2014-10-10T02-08-30.xml";
var doc = XDocument.Load(xmlUrlOrPath);
// parse xml
var offers = doc.Descendants("Предложение")
.Where(o => o.Element("Штрихкод") != null)
//.Skip(400)
//.Take(15)
.Select(o => new {
SKU = o.Element("Штрихкод").Value,
var pabs = new []
{
new {
id = 0, name = "Green Way",
address= "Льва Толстого вул., 31",
lat = 48.62079866700977,
lng = 22.291045737400175
},
new {
id = 1, name = "R4",
@bodia-uz
bodia-uz / client.js
Created September 14, 2016 20:13
graphql-ws-subscription
import { Client } from 'subscriptions-transport-ws';
const client = new Client(`ws://localhost:4001/`);
const query = `subscription events {
eventsUpdated{
Name
}
}`;
@bodia-uz
bodia-uz / Items.js
Last active September 8, 2017 09:32
js http polling
import React, { Component } from 'react';
import isEqual from 'lodash/isEqual';
import ItemsList from './ItemsList';
import createPolling from './createPolling';
class Items extends Component {
constructor(props) {
super(props);
{
"context": "/PATH_TO_MY_APP/node_modules/PATH_TO_LIB/site",
"node": {
"__filename": true
},
"entry": {
"main": "/PATH_TO_MY_APP/node_modules/PATH_TO_LIB/site/.cache/develop-static-entry"
},
"debug": true,
"target": "node",
import {
isAbsoluteURL,
isTrustedURL,
appendParamsToURL,
redirectToURL
} from '../url-fns';
class LoginController {
/*@ngInject*/
constructor($rootScope, $log, $state, commonAuthUser) {