This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var events = require('events'), | |
net = require('net'), | |
channel = new events.EventEmitter(); | |
channel.clients = {}; | |
channel.subscriptions = {}; | |
// Add listener on join event | |
// we save client user object and send | |
channel.on('join', function(id, client) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(){ | |
var app = angular.module("app", ['ngRoute', 'ngAnimate', 'mwl.calendar']); | |
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){ | |
$routeProvider | |
.when("/", { templateUrl: "index.html", controller: "IndexCtrl" }) | |
.when("/statuses", { templateUrl: "main.html", controller: "MainCtrl" }) | |
.when("/tasks", { templateUrl: "tasks.html", controller: "TasksCtrl" }) | |
.when("/task/:id", { templateUrl: "task.html", controller: "TasksCtrl" }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tabs = [{ | |
"text": "Данные пользователя", | |
"id": "user", | |
"active": false, | |
"hide": false | |
}, | |
{ | |
"text": "Информация о компании", | |
"id": "company", | |
"active": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var app = angular.module("kp", ['angularFileUpload', 'ngRoute', 'ngAnimate', 'ngSanitize']); | |
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){ | |
$routeProvider | |
.when("/", { | |
templateUrl: "/offer/edit-template.html", | |
controller: "KpController", | |
controllerAs: "kp", | |
resolve: { | |
'isAdmin': ['$http', '$q', function($http, $q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NativeTouchSlide(selector, minMoveX) { | |
this.domSelector = document.querySelector(selector) || selector; | |
this.sCh = this.domSelector.children; | |
this.checkSelector = !!this.domSelector && this.sCh && this.sCh.length>1; | |
this.minMoveX = minMoveX || 30; | |
if (this.checkSelector) { | |
this.domSelector.addEventListener('touchstart', this.onTouchStart.bind(this)); | |
this.addClass(this.sCh[0], "current"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [1,2,3,4,5].duplicator() | |
Array.prototype.duplicator = function() { | |
var arr = this; | |
if (!this.length) return; | |
Array.prototype.map.call(this, function(el){ arr.push(el); }); | |
return arr; | |
} | |
// sum(1)(2)(3)(); | |
function sum(x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"golang.org/x/tour/tree" | |
"fmt" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <iostream> | |
#include <unordered_map> | |
class Fibonacci final { | |
public: | |
static int get(int n) { | |
assert(n >= 0); | |
if (n == 0 || n == 1) { | |
return n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cassert> | |
#include <cstdint> | |
#include <iostream> | |
template <class Int>; | |
Int gcd(Int a, Int b) { | |
assert(a > 0 && b > 0); | |
Int current_gcd = 1; | |
for (Int d = 1; d * d <= a; d++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def memo(f): | |
cache = {}; | |
def inner(n): | |
if n not in cache: | |
cache[n] = f(n); | |
return cache[n]; | |
return inner; |