Skip to content

Instantly share code, notes, and snippets.

View gerzhan's full-sized avatar

Nikolay Gerzhan gerzhan

View GitHub Profile
if isNaN Date.parse "2011-01-01T12:00:00-05:00"
Date.parse = ((parse) ->
# The date time string format as specified by ES 5.1 section 15.9.1.15.
pattern = ///^
(\d{4}) # Year
(?:-(\d{2}) # Optional month
(?:-(\d{2}) # Optional date
(?: # Optional time component
T(\d{2}) # Hours
:(\d{2}) # Minutes
require.config({
paths: {
jquery: "lib/jqMobi.min",
underscore: "http://underscorejs.org/underscore-min",
backbone: "http://backbonejs.org/backbone"
},
shim: {
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone',
define (['knockout', 'jquery', 'prettyDate', 'metrojs'], function ( ko, $ ) {
"use strict";
// See https://github.com/SteveSanderson/knockout/wiki/Bindings---class
ko.bindingHandlers['class'] = {
'update' : function ( element, valueAccessor ) {
if ( element['__ko__previousClassValue__'] ) {
ko.utils.toggleDomNodeCssClass (element, element['__ko__previousClassValue__'], false);
}
var value = ko.utils.unwrapObservable (valueAccessor ());
angular.module('project', ['projectServices'])
.config ($routeProvider) ->
$routeProvider
.when('/login',
templateUrl: 'partials/login.html',
controller: LoginCtrl)
.when('/assignments',
templateUrl: 'partials/assignments.html',
controller: AssignmentListCtrl)
.otherwise(redirectTo: '/login')
var app = angular.module('app', []);
app.directive('yaTree', function () {
return {
restrict: 'A',
transclude: 'element',
priority: 1000,
terminal: true,
compile: function (tElement, tAttrs, transclude) {
@gerzhan
gerzhan / app.js
Created September 25, 2013 02:12 — forked from joshkurz/app.js
var demoApp = angular.module('demoApp', ['ngResource'], function($locationProvider) {
$locationProvider.hashPrefix('');
});
function MainCtrl($scope, Serv) {
$scope.selectedItem = {
value: 0,
label: ''
};
$scope.Wrapper = Serv;
@gerzhan
gerzhan / app.js
Created September 27, 2013 04:56 — forked from joshkurz/app.js
var demoApp = angular.module('demoApp', ['ngResource'], function($locationProvider) {
$locationProvider.hashPrefix('');
});
function MainCtrl($scope, Serv) {
$scope.selectedItem = {
value: 0,
label: ''
};
$scope.Wrapper = Serv;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
angular.module('keyboard', [])
.factory('keyboardNavigation', function () {
var keyboardContextStack = [];
var navigatables = {};
var activeIndex = 0;
return {
active: null,
register: function (scope, events) {
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");