server is a Rails 4 application that is developed on Ruby 2.0. For the development environment it’s recommended to use the latest stable Ubuntu operating system ( 12.04 + ).
This file contains hidden or 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() { | |
function async_load(){ | |
var s = document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = 'http://yourdomain.com/script.js'; | |
var x = document.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s, x); | |
} | |
if (window.attachEvent) |
This file contains hidden or 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 CustomAuthFailure < Devise::FailureApp | |
def respond | |
self.status = 401 | |
self.content_type = 'json' | |
self.response_body = {"errors" => ["Invalid login credentials"]}.to_json | |
end | |
end |
This file contains hidden or 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
module Api | |
module V1 | |
module CustomDevise | |
class SessionsController < Devise::SessionsController | |
prepend_before_filter :require_no_authentication, :only => [:create ] | |
include Devise::Controllers::Helpers | |
respond_to :json | |
def create |
This file contains hidden or 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 'bundler' | |
def outdated?(options = {}) | |
gems = Array(options[:gems]) | |
sources = Array(options[:source]) | |
Bundler.definition.validate_ruby! | |
current_specs = Bundler.load.specs | |
if gems.empty? && sources.empty? |
This file contains hidden or 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(m,p){function s(a){var d=a.length,e=b.type(a);return b.isWindow(a)?!1:1===a.nodeType&&d?!0:"array"===e||"function"!==e&&(0===d||"number"==typeof d&&0<d&&d-1 in a)}function w(a,d,e,q){if(b.acceptData(a)){var n,r,A=b.expando,g="string"==typeof d,c=a.nodeType,k=c?b.cache:a,h=c?a[A]:a[A]&&A;if(h&&k[h]&&(q||k[h].data)||!g||e!==p)return h||(c?a[A]=h=ia.pop()||b.guid++:h=A),k[h]||(k[h]={},c||(k[h].toJSON=b.noop)),("object"==typeof d||"function"==typeof d)&&(q?k[h]=b.extend(k[h],d):k[h].data=b.extend(k[h].data, | |
d)),n=k[h],q||(n.data||(n.data={}),n=n.data),e!==p&&(n[b.camelCase(d)]=e),g?(r=n[d],null==r&&(r=n[b.camelCase(d)])):r=n,r}}function u(a,d,e){if(b.acceptData(a)){var q,n,r,A=a.nodeType,g=A?b.cache:a,c=A?a[b.expando]:b.expando;if(g[c]){if(d&&(r=e?g[c]:g[c].data)){b.isArray(d)?d=d.concat(b.map(d,b.camelCase)):d in r?d=[d]:(d=b.camelCase(d),d=d in r?[d]:d.split(" "));q=0;for(n=d.length;n>q;q++)delete r[d[q]];if(!(e?B:b.isEmptyObject)(r))return}(e||(delete g[c].data,B(g[c])))&&(A?b.cleanData([a],!0):b.sup |
This file contains hidden or 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
//Chain of responsibility design pattern | |
//Use strategyPipeline.handleRequest(request) | |
//to send the request to be handled along the | |
//chain-of-responsibility | |
var strategyPipeline = { | |
handleRequest: function(request){ | |
var strategy1 = new Strategy1(); | |
var strategy2 = new Strategy2(); |
This file contains hidden or 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 Chopstick | |
attr_accessor :status | |
def initialize | |
@status = 'FREE' | |
end | |
end | |
class Member | |
attr_accessor :name, :chopsticks |