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 'oauth2' | |
require 'omniauth' | |
require 'securerandom' | |
require 'socket' # for SocketError | |
require 'timeout' # for Timeout::Error | |
require 'faraday' # for Faraday::Error::TimeoutError and Faraday::Error::ConnectionFailed | |
require 'multi_json' # for MultiJson::DecodeError | |
module OmniAuth | |
module Strategies |
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
var error:NSError? = nil | |
if let mdStr = String(contentsOfFile: "/path/to/file/test.txt", encoding: NSUTF8StringEncoding, error: &error) { | |
print("File Opened!") | |
} else { | |
if(error != nil) { | |
print(error?.description) | |
} | |
} |
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
// You need to import Foundation to use NSRegularExpression, NSError and NSString | |
import Foundation | |
/// This function takes three parameters | |
/// text: a string that we search in | |
/// pattern: a reqular expression pattern to use in the search | |
/// withTemplate: the string that we use instead of the occurrances we find in text | |
/// | |
/// The method returns (text) with occurrance found using (pattern) replaced with (withTemplate) | |
func regexReplace(text:String, pattern:String, withTemplate:String) -> String { |
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
img { | |
max-width: 100%; | |
max-height: 100%; | |
} |