Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | π :tada: |
Version tag | π :bookmark: |
New feature | β¨ :sparkles: |
Bugfix | π :bug: |
// Run it live on: https://goo.gl/dgwE2D | |
class Example { | |
public getCountries(fields: string[] = ['name', 'alpha2Code', 'translations', 'flag']): Observable<any[]> { | |
const sep = (function* () { | |
let call = 0; | |
while (true) { | |
yield (call++ === 0) ? '?' : '&'; | |
} | |
})(); |
/** | |
* The ultimate split path. | |
* Extracts dirname, filename, extension, and trailing URL params. | |
* Correct handles: | |
* empty dirname, | |
* empty extension, | |
* random input (extracts as filename), | |
* multiple extensions (only extracts the last one), | |
* dotfiles (however, will extract extension if there is one) | |
* @param {string} path |
/* Disclaimer: | |
* This snippet is provided βAS ISβ and could contain technical inaccuracies, typographical errors and out-of-date information. | |
* Use of the information is therefore at your (very) own risk. | |
*/ | |
/*_____________________________________________________________________________________________________________________ | |
* Aim | |
* Provide some solution in case of complex constructs to manage layout from an Angular point-of-view (ex: ngx-datatable) | |
* See: https://github.com/swimlane/ngx-datatable/issues/423 | |
* |
// Play it on Typescript Playground: https://www.typescriptlang.org/play/ | |
class Test { | |
static process(): Promise<any> { | |
let promises = [ | |
Promise.resolve(1), | |
Promise.resolve(2), | |
Promise.reject(3), | |
Promise.resolve(4), | |
new Promise((res, rej) => { throw new Error('Boum'); }), | |
Promise.resolve(6), |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | π :tada: |
Version tag | π :bookmark: |
New feature | β¨ :sparkles: |
Bugfix | π :bug: |
angular.reloadWithDebugInfo(); // https://github.com/angular/angular.js/issues/9515 | |
// Check whether the tagged recordings are set to favourite | |
var dbg_hj = angular.element($(".recordings-table-container table")).scope().pageResponses() | |
.map(elt => { | |
return { | |
"index" : elt.index, | |
"id" : elt.id, | |
"duration" : moment.duration(elt.duration).minutes() + ':' + ('0' + moment.duration(elt.duration).seconds()).slice(-2), | |
"favourite": elt.favourite, |
function clone(obj) { | |
if (Object(obj) !== obj) return obj; | |
if (typeof obj.toJSON == 'function') { | |
return obj.toJSON(); | |
} | |
var type = toString.call(obj).slice(8, -1); | |
if (type in CLONE) { | |
return CLONE[type].call(obj, clone); | |
} | |
var copy = {}; |
declare global { | |
interface Array<T> { | |
groupBy(prop: T): Array<T>; | |
} | |
} | |
if (!Array.prototype.groupBy) { | |
Array.prototype.groupBy = (prop: string) => { | |
return this.reduce(function(groups, item) { | |
const val = item[prop]; |
/* On TypeScript Playground: https://goo.gl/EQVVUk */ | |
// Interface merging: https://www.typescriptlang.org/docs/handbook/declaration-merging.html | |
// declare global { | |
interface Promise<T> { | |
delay(duration?: number): Promise<T>; | |
} | |
// } | |
// Allow some sugar syntax |
let formatFileSize = (bytes) => { | |
if (bytes === 0) { | |
return '0 B'; | |
} | |
const k = 1024, | |
dm = 3, | |
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | |
i = Math.floor(Math.log(bytes) / Math.log(k)); | |