Skip to content

Instantly share code, notes, and snippets.

View NorakGithub's full-sized avatar
🎯
Focusing

Khemanorak Khath NorakGithub

🎯
Focusing
View GitHub Profile
@Edudjr
Edudjr / prettyPrint.swift
Created February 9, 2017 12:45
Swift 3 JSON pretty printing
//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
}
@sgr-ksmt
sgr-ksmt / zenkaku_hankaku.swift
Last active July 15, 2021 18:55
[Swift] : 文字列の全角/半角の変換 + 数字だけ半角/全角変換
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)
}
@douglasmiranda
douglasmiranda / option1.py
Last active April 25, 2024 09:10
Fix: Django Debug Toolbar not showing when using with Docker.
# 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