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
| import UIKit | |
| extension UIColor { | |
| convenience init(hexcode: String, alpha: CGFloat = 1.0) { | |
| let string = hexcode.replacingOccurrences(of: "#", with: "") | |
| let char = string.map { String($0) } | |
| let r = CGFloat(Int(char[0]+char[1], radix:16) ?? 0) / 255.0 | |
| let g = CGFloat(Int(char[2]+char[3], radix:16) ?? 0) / 255.0 | |
| let b = CGFloat(Int(char[4]+char[5], radix:16) ?? 0) / 255.0 |
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
| curl -4 "https://ddns.flinty.moe:4CBbvDalUOfxvXr0@dyn.dns.he.net/nic/update?hostname=ddns.flinty.moe" | |
| */* 1 * * * curl -4 "https://ddns.flinty.moe:4CBbvDalUOfxvXr0@dyn.dns.he.net/nic/update?hostname=ddns.flinty.moe" |
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
| let paraph = NSMutableParagraphStyle() | |
| paraph.lineSpacing = 6 | |
| let attributes = [NSAttributedString.Key.font:UIFont.systemFont(ofSize: 13), | |
| NSAttributedString.Key.paragraphStyle: paraph] | |
| caot901010View.errorMsgTextLabel.attributedText = NSAttributedString(string: errorParam.messageText, attributes: attributes) |
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
| SELECT | |
| NAME | |
| FROM | |
| sysobjects o, | |
| syscomments s | |
| WHERE | |
| o.id = s.id | |
| AND TEXT LIKE '%word%' | |
| AND o.xtype = 'P' | |
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
| dateToSQL: function (jsTime) { | |
| var year = jsTime.getFullYear().toString(); | |
| var month = (jsTime.getMonth() + 1).toString(); | |
| if (month.length = 1) { | |
| month = "0" + month | |
| }; | |
| var date = jsTime.getDate().toString(); | |
| if (date.length = 1) { | |
| date = "0" + date | |
| }; |
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
| <a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px" href="https://unsplash.com/@mylovefromjesus?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from Jung Ho Park"><span style="display:inline-block;padding:2px 3px"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-2px;fill:white" viewBox="0 0 32 32"><title>unsplash-logo</title><path d="M10 9V0h12v9H10zm12 5h10v18H0V14h10v9h12v-9z"></path></svg></span><span style="display:inline-block;padding:2px 3px">Photo by on Unsplash</span></a> |
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
| // 字符串转 DateTime | |
| string dateString = "20210601"; | |
| DateTime date = DateTime.ParseExact(dateString, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture); | |
| // for 循环 | |
| List<string> dateList = new List<string>(); | |
| DateTime startTime = Convert.ToDateTime("2021-06-01"); | |
| DateTime endTime = Convert.ToDateTime("2021-07-01"); | |
| for (DateTime time = startTime; time <= endTime; time = time.AddDays(1)) | |
| { |
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
| int[] ia = {1,2,3}; | |
| int id = Array.IndexOf(ia,1); // 这里的1就是你要查找的值 | |
| if(id==-1) | |
| // 不存在 | |
| else | |
| // 存在 |
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 copyToClipboard(elementId) { | |
| // Create an auxiliary hidden input | |
| var aux = document.createElement("input"); | |
| // Get the text from the element passed into the input | |
| aux.setAttribute("value", document.getElementById(elementId).innerHTML); | |
| // Append the aux input to the body | |
| document.body.appendChild(aux); |
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
| public bool IsLightColor(Color color) | |
| { | |
| return (0.299 * color.R + 0.587 * color.G + 0.114 * color.B) / 255 > 0.5; | |
| } |
NewerOlder