Ask postgresql where is the configuration file
$ psql postgres
psql (9.2.2)
Type "help" for help.
it 'sends email to admin with error response' do | |
VCR.use_cassette('external_service_response_cassette/invalid_requests', record: :new_episodes) do | |
Hash.any_instance.stub(:value_from_params).and_raise(ExceptionType, "Failed to find key in params") | |
params1 = 'AdminMailer' | |
params2 = 'errors' | |
params3 = 'Error message: There has been an error' | |
SendEmailWorker.should_receive(:perform_async).with(params1, params2, params3).exactly(1).times |
//Set a NSTimer to update call this function every n seconds to provide desired effect. | |
var numberOfDots = 3 | |
func applySearchingEffect() { | |
if let str = label.text { | |
let range = NSMakeRange(str.length - numberOfDots, numberOfDots) | |
var string = NSMutableAttributedString(string: str) | |
string.addAttribute(NSForegroundColorAttributeName, value: UIColor.clearColor(), range: range) | |
label.attributedText = string |
//: Playground - noun: a place where people can play | |
import UIKit | |
class LoginView { | |
var loginSuccessCallback: ((Int)->Void)? | |
init() { | |
println("login: - hello") |
json = JSON.parse(`plutil -convert json -o - "#{filename}"`) |
$ = jQuery; | |
var indexToDelete = 0; | |
var numOfLinksToDelete = 200; | |
var waitUntilNextLinkInMs = 1000; | |
var waitForModalInMs = 50; | |
var confirmDelete = function() { | |
setTimeout(function() { | |
var $confirmationButtonInModal = $(".button-primary"); |
import Foundation | |
protocol Getter { | |
typealias Element | |
func getUrl() -> String | |
func getDataFrom(dictionary: NSDictionary) -> Element | |
func get(success success: Element -> (), failure: () -> ()) | |
} | |
extension Getter { //Add default behaviour to Getter protocol. This behaviour depends on implementation of other protocol methods. |
import Foundation | |
protocol Getter { | |
typealias Element | |
func getUrl() -> String | |
func getDataFrom(dictionary: NSDictionary) -> Element | |
func get(success success: Element -> (), failure: NetworkStatus -> ()) |
struct Languages { | |
class Get: Getter { | |
func getUrl() -> String { | |
return "http://some_languages_website.com" | |
} | |
func getDataFrom(dictionary: NSDictionary) -> [Language] { | |
return extractLanguagesFrom(dictionary) |
struct Languages { | |
func get(success success: [Language] -> (), | |
failure: NetworkStatus -> ()) { | |
let qos = Int(QOS_CLASS_USER_INTERACTIVE.rawValue) | |
dispatch_async(dispatch_get_global_queue(qos, 0)) { | |
let responseHandler = ResponseHandler() | |
responseHandler.failureCallback = { status in |