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';
var workersModule = angular.module('App.Workers');
workersModule.service('InsertDataWorker', [
'$rootScope',
'$cordovaSQLite',
'WorkerBridge',
'LocalDB',
function(signInDate, signOutDate, PauseOptions, PauseOptionId, isSignInTimeSelected, isSignOutTimeSelected) {
// Calculate number of hours employee has worked for
var signInDate = new Date(signInDate),
signOutDate = new Date(signOutDate),
signInOffset = isSignInTimeSelected ? 0 : signInDate.getTimezoneOffset() * 60 * 1000,
signOutOffset = isSignOutTimeSelected ? 0 : signOutDate.getTimezoneOffset() * 60 * 1000,
diff = signOutDate - signInDate + signOutOffset - signInOffset,
pause = 0,
workingMinutes,
workingHours,
var fs = require('fs');
var mapFilePath = './classes-map.json';
var filesToReplace = [
{ path: './main.css', rename: './main-rename.css', type: 'css'},
{ path: './index.html', rename: './index-rename.html', type: 'html'},
{ path: './scripts.js', rename: './scripts-rename.js', type: 'js'}
];
@Component({
selector: 'product',
template: `Product details`
})
export class ProductComponent{
constructor(
private store: Store<AppStore>,
private httpService: HttpService
){}
}
@NgModule({
declarations: [
AppComponent,
],
imports: [
// Angular core dependencies
BrowserModule,
HttpModule,
// Http service
export abstract class Sandbox {
protected loggedUser$ = this.appState$.select(store.getLoggedUser);
constructor(protected appState$: Store<store.State>) {}
/**
* Returns complete or partial state from the store
*
* @param store
* @param property
@Injectable()
export class AuthSandbox extends Sandbox {
public loginLoading$ = this.appState$.select(store.getLoginLoading);
public loginLoaded$ = this.appState$.select(store.getLoginLoaded);
public passwordRecoveryLoading$ = this.appState$.select(store.getPasswordRecoveryLoading);
public passwordRecoveryLoaded$ = this.appState$.select(store.getPasswordRecoveryLoaded);
constructor(protected appState$: Store<store.State>) {
super(appState$);
export interface State {
products: fromProducts.State;
login: fromAuth.State;
}
const reducers = {
products: fromProducts.reducer,
login: fromAuth.reducer
};
@Effect()
doLogin$: Observable<Action> = this.actions$
.ofType(actions.ActionTypes.DO_LOGIN)
.map((action: actions.DoLoginAction) => action.payload)
.switchMap(state => {
return this.authApiClient.login(state)
.map(user => new actions.DoLoginSuccessAction(new User(user)))
.catch(error => of(new actions.DoLoginFailAction()));
});
@Injectable()
@DefaultHeaders({
'Accept': 'application/json',
'Content-Type': 'application/json'
})
export class ProductsApiClient extends HttpService {
@PUT("/products/{id}")
public updateProductById(@Path("id") id: number, @Body product: Product): Observable<any> { return null; };
}