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 to pretty-print Json Object in Swift 3 | |
func prettyPrint(with json: [String:Any]) -> String{ | |
let data = try! JSONSerialization.data(withJSONObject: json, options: .prettyPrinted) | |
let string = NSString(data: data, encoding: String.Encoding.utf8.rawValue) | |
return string as! String | |
} |
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
extension String { | |
private func convertFullWidthToHalfWidth(reverse: Bool) -> String { | |
let str = NSMutableString(string: self) as CFMutableString | |
CFStringTransform(str, nil, kCFStringTransformFullwidthHalfwidth, reverse) | |
return str as String | |
} | |
var hankaku: String { | |
return convertFullWidthToHalfWidth(false) | |
} |
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
# YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py | |
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',) | |
# And it will change, then you will have to change INTERNAL_IPS again. | |
def show_toolbar(request): | |
if request.is_ajax(): | |
return False | |
return True |