View AuthenticationService.ts
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
import { AxiosInstance } from "axios"; | |
import RxAxios from 'axios-observable'; | |
import { delay, map, Observable, of, Subscription } from "rxjs"; | |
export class Session { | |
constructor( | |
readonly accessToken: string, | |
readonly client: string, | |
readonly uid: string, | |
readonly expiry: string |
View GuestObjectUsingNullObjectDesignPattern.swift
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
import Foundation | |
protocol User { | |
var firstName: String { get } | |
var lastName: String { get } | |
func fullName() -> String | |
} | |
class CurrentUser: User { |
View OptionalUserExample.swift
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
import Foundation | |
struct User { | |
let firstName: String | |
let lastName: String | |
func fullName() -> String { | |
return "\(firstName) \(lastName)" | |
} | |
} |
View ObjectAnalytics.swift
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
import Foundation | |
// this is either a third party SDK interface or your own analytics client implementation | |
// that actually sends JSON across the wire to deliver tracked analytics events | |
protocol AnalyticsClient { | |
func sendAnalyticsDataToTheBackend(_ eventJSON: [String: Any]) | |
} | |
final class ConcreteAnalyticsClient: AnalyticsClient { | |
func sendAnalyticsDataToTheBackend(_ eventJSON: [String: Any]) { |
View HLPlaceResourceManager.h
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
// | |
// HLPlaceResourceManager.h | |
// HeyLets2 | |
// | |
// Created by Alex Bush on 11/18/14. | |
// Copyright (c) 2014 HeyLets. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
View boolean_value.rb
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 BooleanValue < Value | |
end |
View for_socpe.rb
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 for_scope(scope, user = GuestUser.new) | |
case scope | |
when 'saved' | |
user.saved_articles.scoped | |
when 'my' | |
user.tagged_articles.scoped | |
else | |
scoped | |
end | |
end |
View article.rb
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 Article < ActiveRecord::Base | |
include Categorizable | |
APPROVED = 'approved' | |
PENDING = 'pending' | |
REJECTED = 'rejected' | |
attr_accessible :approved_at, :url, :body, :image, :rating, :state, :title, :news_source_id, :published_at | |
validates :url, :uniqueness => true |
View articles_controller.rb
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 Api::Private::ArticlesController < Api::Private::BaseController | |
include ArticlesSearch | |
before_filter :find_or_create_article, except: [:index] | |
PAGE_SIZE = 20 | |
attr_accessor :total_pages | |
def index | |
@articles = Article |
View article.rb
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 Article < ActiveRecord::Base | |
include Categorizable | |
APPROVED = 'approved' | |
PENDING = 'pending' | |
REJECTED = 'rejected' | |
attr_accessible :approved_at, :url, :body, :image, :rating, :state, :title, :news_source_id, :published_at | |
validates :url, :uniqueness => true |
NewerOlder