Skip to content

Instantly share code, notes, and snippets.

View anteburazer's full-sized avatar
💭
Ride hard live free

Ante Burazer anteburazer

💭
Ride hard live free
View GitHub Profile
(function() {
'use strict';
/* ***************************************************************************
* ### WorkerBridge module ###
*
* Module for constructing web workers
* Reference: https://github.com/blittle/bridged-worker
* ***************************************************************************
*/
@anteburazer
anteburazer / fast-scroll.scss
Last active October 28, 2019 02:17
Ionic fast scroll
fast-scroll {
position: fixed;
top: 102px;
right: 5px;
padding: 10px 5px;
background: #f8f8f8;
border-radius: 10px;
border: 1px solid #ddd;
span {
@anteburazer
anteburazer / api.js
Last active August 31, 2017 12:54
API call that accepts querystring parameters
/**
* Retrieves quantities for particular product, by a given product color
*
* @param productId
*/
@GET("/products/{id}/quantities")
public getProductQuantities(@Path("id") id: number, @Query("color") color: number): Observable<any> { return null; };
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/service-worker.js')
.then(function(registration) {
console.log('Service Worker registered');
}).catch(function(err) {
console.log('Service Worker registration failed: ', err);
});
}
module.exports = {
navigateFallback: '/index.html',
stripPrefix: './dist',
root: '../root/',
staticFileGlobs: [
'./dist/index.html',
'./dist/**.js',
'./dist/**.css',
'./dist/**.ttf',
'./dist/assets/images/*',
/**
* Capitalizes the first character in given string
* @param s
*/
export function capitalize(s: string) {
if (!s || typeof s !== 'string') return s;
return s && s[0].toUpperCase() + s.slice(1);
}
/**
* Translates given message code and title code and
* displays corresponding notification
*
* @param msgCode
* @param type
* @param titleCode
*/
public displayNotification(msgCode: string, type: string = 'info', titleCode?: string) {
function mergeAndSaveJsonFiles(src, dest) {
jsonConcat({ src: src, dest: dest },
(res) => console.log('Localization files successfully merged!');
);
}
// Merge all localization files into one
mergeAndSaveJsonFiles(localizationSourceFilesEN, "./i18n/en.json");
mergeAndSaveJsonFiles(localizationSourceFilesHR, "./i18n/hr.json");
private setupLanguage(): void {
// Load localization object from the confguration
let localization: any = this.configService.get('localization');
// Save language codes as an array
let languages: Array<string> = localization.languages.map(lang => lang.code);
// Get browser’s default language
let browserLang: string = this.translate.getBrowserLang();
translateService.get('HeaderTitle').subscribe(
value => {
let alertTitle = value;
}
)
let title = translateService.instant('HeaderTitle');