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
private Page<GroupedCustomerTransaction> groupCustomerTransactionRecordByMonthOfYear(Page<CustomerTransactionDTO> customerTransactionPage) { | |
List<CustomerTransactionDTO> customerTransactions = customerTransactionPage.getContent(); | |
Map<String, List<CustomerTransactionDTO>> store = new HashMap<>(); | |
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("MMMM-yyyy"); | |
customerTransactions.stream().forEach(customerTransaction -> { | |
String createdYearMonth = dateTimeFormatter.format(customerTransaction.getCreatedDate()); | |
if(store.containsKey(createdYearMonth)){ | |
store.get(createdYearMonth).add(customerTransaction); | |
}else{ |
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
import {Component, OnInit, ViewChild} from '@angular/core'; | |
import {SharedService} from '../../../services/shared-service/shared.service'; | |
import {Constants} from '../../../util/Constants'; | |
import {AnonymousService} from '../../../services/anonymous-service'; | |
import {AuthService} from '../../../services/auth-service/auth-service.service'; | |
import {MdSnackBar, MdSnackBarConfig} from '@angular/material'; | |
import {FormBuilder, FormGroup, FormGroupDirective, Validators} from '@angular/forms'; | |
import {ErrorService} from '../../../util/error_service/error.service'; | |
import {ToastService} from '../../../util/toast-service/toast.service'; | |
import {MobileNetworks} from '../../../util/mobile-networks'; |
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
class Solution: | |
def lengthOfLongestSubstring(self, s: str) -> int: | |
cursor = 0 | |
start = 0 | |
end = len(s) | |
longest = 0 | |
subStringMap = {} | |
while start < end: |
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
function first_repeating_character(characters) { | |
if (characters == undefined || characters.length == 0) { | |
return undefined; | |
} | |
let dict = {}; | |
for (i = 0; i < characters.length; i++) { | |
if (dict[characters.charAt(i)] == undefined) { | |
dict[characters.charAt(i)] = true; |
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
def first_repeating_character(characters): | |
if not characters: | |
return None | |
characterSet = set() | |
for c in characters: | |
if c in characterSet: | |
return c | |
else: | |
characterSet.add(c) |
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
#!/usr/bin/python3 | |
import argparse | |
import logging | |
import subprocess | |
import os | |
import tempfile | |
from tempfile import mkstemp | |
import configparser | |
import gzip |
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
{ | |
"countries": [ | |
{ | |
"country": "Afghanistan", | |
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"] | |
}, | |
{ | |
"country": "Albania", | |
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"] | |
}, |
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
<!doctype html> | |
<html lang="en"> | |
<!-- Copyright 2017 Nishant Srivastava | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
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
@Injectable() | |
export class AuthInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, | |
next: HttpHandler): Observable<HttpEvent<any>> { | |
const idToken = localStorage.getItem("id_token"); | |
if (idToken) { | |
const cloned = req.clone({ |
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
select au.first_name, au.last_name, au.email, p.user_id as "User Id", p.id as "Pledge Id", p.amount as "Pledged Amount", | |
(select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id) as "Paid Amount" | |
from pledge p | |
join auth_user au on au.id = p.user_id | |
where p.amount > (select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id); |
NewerOlder