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
Array.prototype.initalizePaging = function(itemsPerPage){ | |
this.pageNumber = 1 | |
this.itemsPerPage = isNaN(itemsPerPage) ? 10 : Number(itemsPerPage) | |
this.totalPages = Math.ceil(this.length/this.itemsPerPage) | |
} | |
Array.prototype.getCurrentPage = function(){ | |
if(typeof this.pageNumber == "undefined"){ | |
this.initalizePaging() | |
} |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
# CUSTOM EXCEPTION HANDLING | |
rescue_from Exception do |e| | |
error(e) | |
end | |
def routing_error |
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
class MailSender | |
def self.send_mail(smtp_settings, user, mail_subject, mail_body) | |
options = { :address => smtp_settings["address"], | |
:domain => smtp_settings["domain"], | |
:port => smtp_settings["port"].to_i, | |
:user_name => smtp_settings["user_name"], | |
:password => smtp_settings["password"], | |
:authentication => smtp_settings["authentication"], | |
:enable_starttls_auto => true, | |
:openssl_verify_mode => 'none' |
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
// My Application | |
var myApp = angular.module('myAngularApp', ['ui']); | |
// A Directive to generate Dynamic Template | |
myApp.directive('dynamicTemplate', function ($compile) { | |
return { | |
restrict: 'E', | |
scope: { form_generator_schema: '=data' }, | |
link: function (scope, elm, attrs) { | |
console.log("Directive Called"); |
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
require 'rack' | |
require 'rack/request' | |
require 'rack/response' | |
require 'rubygems' | |
require 'json' | |
require 'mysql2' | |
require 'mongo' | |
module Rack | |
class ServerStatus |
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
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
# For all responses in this controller, return the CORS access control headers. | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' | |
headers['Access-Control-Max-Age'] = "1728000" | |
end |