Skip to content

Instantly share code, notes, and snippets.

View ipassynk's full-sized avatar

Julia Passynkova ipassynk

View GitHub Profile
@ipassynk
ipassynk / mashup.js
Last active December 21, 2015 00:08
Mashup on node
/**
* Module dependencies.
*/
var express = require('express'), async = require('async'), http = require('http'), path = require('path'), sys = require('util'),
rest = require('restler');
var app = express();
// all environments
@ipassynk
ipassynk / DojoFunWithHitchAndPartial.js
Created August 1, 2013 03:33
Do partial, hitch and promises were for very long time.
var renderResponse = dojo.partial(dojo.hitch(this, function(obj, data) {
this._processResponse(data, obj);
}), obj);
var renderErrorResponse = dojo.partial(dojo.hitch(this, function(obj, data) {
this._processErrorResponse(data, obj);
}), obj);
dojo.xhrGet(args).then(renderResponse, renderErrorResponse);
_processResponse : function (data, obj) { ... }
@ipassynk
ipassynk / Selenium_Dojo_Filtering_select_All.java
Created July 31, 2013 21:38
Get list of all items in Dojo filtering select using Selenium
// All items
List<WebElement> elements = driver
.findElements(By
.xpath("//li[contains(@id,'xxxFilteringSelect_') and contains(@id,'_popup') "
+ " and not(contains(@class,'dijitMenuPreviousButton'))"
+ " and not(contains(@class,'dijitMenuNextButton'))]"));
// Get map of all dojo popupId to name
for (WebElement element : elements) {
String id = element.getAttribute("id");
@ipassynk
ipassynk / Selenium_DojoButton.java
Created July 31, 2013 21:33
Find Dojo button with Selenium
WebElement button = driver
.findElement(By
.xpath("//button[contains(@class,'dijitButtonContents')]/span[contains(text(),'Button title')]"));
button.click();
@ipassynk
ipassynk / SeleniumDojoSelect.java
Created July 31, 2013 21:29
click on dojo select in selenium
Selenium selenium = new WebDriverBackedSelenium(driver,driver.getCurrentUrl());
selenium.mouseDown("xxxFilteringSelect");
selenium.mouseOver(popupId);
selenium.mouseUp(popupId);
@ipassynk
ipassynk / jasmine_data_matcher.js
Created July 31, 2013 20:33
Jasmine toBeDate() matcher
beforeEach(function() {
this.addMatchers({
toBeDate: function(expected) {
return (new Date(expected) instanceof Date);
}
});
});
@ipassynk
ipassynk / standby.js
Created July 31, 2013 20:23
Do standby initialization
var standby = new dojox.widget.Standby({target: id});
document.body.appendChild(standby.domNode);
standby.startup();
standby.show();
@ipassynk
ipassynk / dojo_dynamic_class.js
Last active December 20, 2015 11:48
Create Dojo class in runtime
var clazz = "dojo class name";
dojo["require"](clazz);
var ctor = dojo.getObject(clazz);
var widget = new ctor(artts);
@ipassynk
ipassynk / gist:6123147
Created July 31, 2013 15:40
Dojo export grid and download
// CVS data
var bytes =[]
//populate bytes...
var data = dojox.encoding.base64.encode(bytes);
// export
var filename = filename + "_" + dojo.date.locale.format(new Date(),
{datePattern: "MM_dd_yyyy",timePattern: "HH_mm_ss"});
dojo.byId("exportbutton").href='data:application/vnd.ms-excel;base64,' +data;
dojo.byId("exportbutton").download= filename + ".csv";
@ipassynk
ipassynk / gist:6123140
Created July 31, 2013 15:40
Dojo export grid and download
// CVS data
var bytes =[]
//populate bytes...
var data = dojox.encoding.base64.encode(bytes);
// export
var filename = filename + "_" + dojo.date.locale.format(new Date(),
{datePattern: "MM_dd_yyyy",timePattern: "HH_mm_ss"});
dojo.byId("exportbutton").href='data:application/vnd.ms-excel;base64,' +data;
dojo.byId("exportbutton").download= filename + ".csv";