Skip to content

Instantly share code, notes, and snippets.

View just-boris's full-sized avatar

Boris Serdiuk just-boris

View GitHub Profile
@just-boris
just-boris / index.js
Created June 28, 2016 10:23
requirebin sketch
var React = require('react');
var ReactDOM = require('react-dom');
var Redux = require('redux');
var ReactRedux = require('react-redux');
function counter(state = 0, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1
case 'DECREMENT':
@just-boris
just-boris / spy-ajax.js
Created April 27, 2016 16:34
Mocked Backbone.ajax
import $ from 'jquery';
import Backbone from 'backbone';
export var ajaxSpy;
export default function spyAjax() {
var deferreds;
beforeEach(function() {
deferreds = [];
ajaxSpy = spyOn(Backbone, 'ajax').and.callFake(({success, error}) => {
@just-boris
just-boris / package.json
Last active April 21, 2016 14:31
mocha-allure-16
{
"name": "mocha-allure-16",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"prepublish": "selenium-standalone install",
"pretest": "rm -rf allure-results",
"test": "multi='progress=- mocha-allure-reporter=-' mocha test.js --reporter mocha-multi --timeout 30000",
"report": "allure generate allure-results"
@just-boris
just-boris / package.json
Created April 10, 2016 21:05
Reproduce issue with postcss-modules and cssnano
{
"name": "postcss-bug",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
@just-boris
just-boris / .gitignore
Last active March 5, 2016 08:07
Redux#1468
node_modules/
dist/
@just-boris
just-boris / index.js
Created January 21, 2016 10:15
Handlebars loader for node.js
const fs = require('fs');
const path = require('path');
const Handlebars = require('handlebars/dist/cjs/handlebars');
// configuration the same as webpack handlebars-loader has
const config = {
helperDirs: [
path.resolve(__dirname, '../src/helpers'),
path.resolve(__dirname, '../src/blocks')
]
@just-boris
just-boris / run.js
Created December 10, 2015 11:14
Jasmine Program API
var jasmine = new Jasmine();
jasmine.loadConfig({
spec_dir: 'src',
spec_files: [
'js/**/*.spec.js'
],
helpers: ['spec/bootstrap.js']
});
jasmine.onComplete(function(passed) {
done(passed ? null : 'Some tests has been failed');
"use strict";
class Queue {
constructor() {
this.top = Promise.resolve();
}
push(operation) {
return this.top = this.top
.then(() => this.delay())
.then(() => operation());
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@just-boris
just-boris / search-page.js
Last active October 20, 2015 13:03
JSUnderhood webdirver.io PageObject
"use strict";
function SearchBox(selector) {
this.selector = selector || ".search2";
this.input = this.selector + " [name=text]";
this.submitButton = this.selector + " [type=submit]";
}
module.exports = new SearchBox();