Skip to content

Instantly share code, notes, and snippets.

View i-van's full-sized avatar
🇺🇦

Ivan Nosov i-van

🇺🇦
View GitHub Profile
@i-van
i-van / select.tsx
Last active October 18, 2016 10:16
import * as React from 'react';
interface ISelectProps {
value?: string;
options: SelectOption[];
placeholder?: string;
onChange?: (value: SelectOption) => void;
}
interface ISelectState {
export class ProductService extends BaseService {
private channelsObservable: Observable<ChannelsResponse>;
constructor (protected http: Http) {
super(http);
this.channelsObservable = this.makeRequest('channels').cache();
}
getChannels(): Observable<ChannelsResponse> {
function algorithm(x, y, z, w) {
var n = 0;
for (var i = 0; i <= w / x; i++) {
for (var j = 0; j <= w / y; j++) {
for (var k = 0; k <= w / z; k++) {
console.log(i, j, k, '=', i * x + j * y + k * z);
if (i * x + j * y + k * z === w) {
Candy weighs X grams, tangerine - Y grams and apple - Z grams.
Need to write a program that will determine how many different versions of gifts weighing exactly W grams can make Santa Claus.
Input data
Function should receive four integers X, Y, Z and W.
Output data
{
"request": "api\/v2\/products\/week",
"set": "New This Week",
"page": 1,
"count": 8,
"limit": 16,
"items": [{
"type": "product",
"template": "single-media",
"id": 4171,
@i-van
i-van / steps
Last active August 1, 2016 13:54
1 удачная регистрация
1 - заходим на landing page(lp)
2 - вводим firstName, lastName, email, phone, password
3 - после сабмита отправляется запрос на node app, где он отправляет запрос регистрации на tds
4 - после успешной регистрации, node app отправляет ответ с редирект линкой,
типа https://www.optionstarsglobal.com/?hash=f55fe15c-cd7d-4e6b-8389-18874d40330c
где хеш мы взяли из тела ответа tds api с поля data.user.sessionId
5 - фронт енд редиректит на линку юзера логинит на optionstarsglobal
'use strict';
let BaseTask = require('./base')
, BaseNetwork = require('../networks/base');
class BlacklistTask extends BaseTask {
async run() {
if (process.env.DRY_RUN === 'true') {
return;
}
@i-van
i-van / test.js
Last active March 21, 2016 17:01
'use strict';
let request = require('supertest')
, expect = require('chai').expect
, server = require('../../../api')
, Campaign = require('../../../app/models/campaign')
, AuthService = require('../../../app/services/auth');
describe('app/controllers/campaign', function() {
let token;
'use strict';
require('dotenv').load();
require("babel-register")({
only: /app|test/,
plugins: ['transform-async-to-generator']
});
let glob = require('glob')
'use strict';
let expect = require('chai').expect
, AuthService = require('../../../app/services/auth')
, policy = require('../../../app/policies/authenticated');
describe('app/policies/authenticated', function() {
it('returns auth info when token is valid', async function() {
let id = 1
, req = { headers: { authentication: await AuthService.generateToken(id) } }