Skip to content

Instantly share code, notes, and snippets.

View ipassynk's full-sized avatar

Julia Passynkova ipassynk

View GitHub Profile
// list of calls...
var callList = {
google: 'http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json',
github: 'https://jobs.github.com/positions.json?description=dojo'
};
app.get('/aggview', function(request, response) {
var Executer = function(url) {
return function(callback) {
rest.get(url).on('complete', function(data, response) {
@ipassynk
ipassynk / wordcount.js
Created July 31, 2013 15:00
Read files from a provided directory, count words in each file, sort words and print [file - count]
var fs = require('fs');
var async = require('async');
var getFileList = function(callback) {
fs.readdir(dirName, function(err, files) {
if(err) {
console.log("an error reading dir");
callback("an error reading dir");
}
else {
@ipassynk
ipassynk / gist:6122858
Created July 31, 2013 15:14
Dojo testing with Jasmine. Call a function that does a lot of stuff and also sends pub/sub event. Verify that event is fired.
'use strict';
dojo.require("xxx.highcharts.HighchartsDemoUtils");
describe('HighchartsUtils', function() {
it("clickEvent generates pub/sub event", function() {
var received = {ok: false};
// subscribe
dojo.subscribe("xxx/chart/plotOptions/point/click/1", received, function() {
@ipassynk
ipassynk / gist:6122925
Created July 31, 2013 15:19
Dojo unit testing with jasmine and jasmine-jquery for dom verification
'use strict';
dojo.require("xxx.comment.CommentList");
describe('CommentList', function() {
var containerId= null;
beforeEach(function() {
var html = '<div id ="comment_container_' + this.id + '"></div>';
setFixtures(html);
@ipassynk
ipassynk / gist:6122971
Created July 31, 2013 15:25
Maven resource substitution for multiple enviroments
<build>
<finalName>MyName</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
@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";
@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 / 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 / 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 / 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);
}
});
});