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
{ | |
"workbench.iconTheme": "vscode-icons", | |
"editor.fontFamily": "'Sarasa Term SC', Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontSize": 16, | |
"terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular','Sarasa Term SC',MesloLGS NF", | |
"terminal.integrated.fontSize": 14, | |
"workbench.colorCustomizations": { | |
"terminal.background": "#090300", | |
"terminal.foreground": "#A5A2A2", | |
"terminalCursor.background": "#A5A2A2", |
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
// OData json date string "/Date(1545727221)" to Timestamp | |
Pattern pattern = Pattern.compile("(\\d+)"); | |
String onboardingDate = "/Date(1545727221)"; | |
Matcher matcher = pattern.matcher( onboardingDate ); | |
if (matcher.find()) { | |
String matched = matcher.group(); | |
Timestamp dateToValidate = new Timestamp(Long.parseLong(matched)); | |
} |
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
// http://momentjs.com/docs/#/get-set/day/ | |
const lastMon = moment().day(-6).startOf('day').format('x'); | |
const lastSun = moment().day(0).endOf('day').format('x'); | |
const lastMon2 = moment().startOf('week').days(-6).format('x'); | |
const lastSun2 = moment().startOf('week').format('x'); |
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
const arr = []; | |
function checkArr(val) { | |
console.log('checkval', val); | |
const i = arr.indexOf(val); | |
if (i !== -1) { | |
arr.splice(i, 1); | |
} else { | |
arr.push(val); | |
} |
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
// Place your settings in this file to overwrite the default settings | |
{ | |
"editor.fontSize": 14, | |
"editor.fontFamily": "Sarasa Mono Sc, Inziu Iosevka SC, Menlo, Monaco, 'Courier New', monospace", | |
"editor.tabSize": 2, | |
"editor.renderControlCharacters": true, | |
"editor.renderWhitespace": "all", | |
"extensions.ignoreRecommendations": false, | |
"files.autoSave": "onFocusChange", | |
"window.zoomLevel": 0, |
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
func checkDates(birthdays: [Date], today: Date, days: Int) -> Set<Date> { | |
let calendar = Calendar.current | |
let thisYear = calendar.component(.year, from: today) | |
var celebrateList = Set<Date>() | |
var datesToCheck: ClosedRange<Date> { | |
return today...today.addingTimeInterval(3600*24*Double(days)) | |
} | |
for birthday in birthdays { | |
var dateCompenents = calendar.dateComponents([.year, .month, .day], from: birthday) |
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
{{#messagebodys}} | |
<p><a href= "{{href}}">{{linktext}}</a></p> | |
{{/messagebodys}} |
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
func copyFile() { | |
let manager = NSFileManager.defaultManager() | |
let bundlepath = NSBundle.mainBundle().resourcePath! + "/temp" | |
let dirPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory,.UserDomainMask, true) | |
let docsDir: AnyObject = dirPaths[0] | |
do { |
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
navigationController!.navigationBar.barTintColor = UIColor(red:8/255, green:64/255 ,blue:164/255 , alpha:1.00) |
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
do { | |
// Load the `product_list.mustache` resource of the main bundle | |
let template = try Template(named: "product/product_list") | |
let bundlePath = NSBundle.mainBundle().bundlePath | |
let data = NSData(contentsOfFile: bundlePath + "/product/product_list.json") | |
let json: AnyObject = try NSJSONSerialization.JSONObjectWithData(data!, options:.AllowFragments) | |
// Convert to Dictionary: |