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
showModalBottomSheet( | |
context: context, | |
builder: (context) { | |
return ModalBottomSheet(this.selected, this.data, (selected, data) { | |
this.selected = selected; | |
this.data = data; | |
}); | |
}); | |
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
static String formatBytes(int bytes, int decimals) { | |
if (bytes <= 0) return "0 B"; | |
const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | |
var i = (log(bytes) / log(1024)).floor(); | |
return ((bytes / pow(1024, i)).toStringAsFixed(decimals)) + | |
' ' + | |
suffixes[i]; | |
} |
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 org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.util.*; | |
public class JsonHelper { | |
public static Object toJSON(Object object) throws JSONException { | |
if (object instanceof Map) { | |
JSONObject json = new JSONObject(); |
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
public class FlexibleDateParser { | |
private List<ThreadLocal<SimpleDateFormat>> threadLocals = new ArrayList<ThreadLocal<SimpleDateFormat>>(); | |
public FlexibleDateParser(List<String> formats) { | |
threadLocals.clear(); | |
for (final String format : formats) { | |
ThreadLocal<SimpleDateFormat> dateFormatTL = new ThreadLocal<SimpleDateFormat>() { | |
protected SimpleDateFormat initialValue() { | |
SimpleDateFormat sdf = new SimpleDateFormat(format); | |
sdf.setLenient(false); |
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 { Injectable } from '@angular/core'; | |
import { EventManager } from '@angular/platform-browser'; | |
import { Subject, Subscription } from 'rxjs'; | |
import { debounceTime, throttle, throttleTime } from 'rxjs/operators'; | |
type TimeoutHandler = () => Function; | |
/** | |
* prevent debounce click | |
*/ | |
@Injectable({ |
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 { | |
Directive, | |
ElementRef, | |
forwardRef, | |
HostListener, | |
OnInit, | |
Renderer2 | |
} from '@angular/core'; | |
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | |
import * as moment from 'moment'; |
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 { CommonUtils } from 'src/shared/utils/common-utils'; | |
import { DecimalPipe } from '@angular/common'; | |
import { | |
Directive, | |
ElementRef, | |
forwardRef, | |
HostListener, | |
Input, | |
OnInit, |
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
ls -r -n -file | foreach{ (cat -encoding UTF8 $_ ) -join "`n" | set-content -encoding UTF8 $_ } |
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, Inject, InjectionToken } from "@angular/core"; | |
import { HttpClient, HttpXhrBackend } from "@angular/common/http"; | |
import { Observable } from "rxjs/Observable"; | |
// import { CUSTOMER_HTTP_CLENT } from "./app.module"; | |
export const CUSTOMER_HTTP_CLENT = new InjectionToken("xx"); | |
@Component({ | |
selector: "my-app", | |
template: ` |
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 shallowCopy<T>(origin: T): T { | |
return Object.assign( | |
Object.create(Object.getPrototypeOf(origin)), | |
origin | |
) | |
} | |
function shallowCopy2<T>(origin: T): T { | |
const obj = { ...origin }; | |
Object.setPrototypeOf(obj, (origin as Object).constructor.prototype); |
OlderNewer