Skip to content

Instantly share code, notes, and snippets.

View artworkad's full-sized avatar
✌️

Artjom Zab artworkad

✌️
View GitHub Profile
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil');
/**
* This adds a content range header to each find response.
* That allows us to implement a pagination client side.
*/
module.exports = function(req, res) {
if (actionUtil.parsePk(req)) {
return require('./findOne')(req, res);
@artworkad
artworkad / DefaultRecycleViewScrollListener.java
Last active September 11, 2016 20:51
Implementation of RecyclerView.OnScrollListener
import android.support.v7.widget.RecyclerView;
/**
* You may set a scroll listener on a recycler view in order to be notified about scroll events.
*/
public class DefaultRecycleViewScrollListener extends RecyclerView.OnScrollListener {
OnScrollStateListener onScrollStateListener;
@artworkad
artworkad / auth-guard.service.ts
Created February 21, 2017 11:31
Building an Authentication Observable Data Service - auth-guard.service.ts
import {Injectable} from '@angular/core';
import {CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import {AuthService} from './auth.service';
@Injectable()
export class AuthGuard implements CanActivate {
constructor(private authService: AuthService,
private router: Router) {
@artworkad
artworkad / IconTabLayout.kt
Last active March 14, 2017 17:28
Android TabLayout with icons and color state list
/**
* IconTabLayout is an extension of TabLayout and enables us to use icons instead of
* text for the tabs. To reuse a single icon for different states we simply tint it
* with color state list. I use vector drawables for icons.
*/
class IconTabLayout : TabLayout {
private var viewPager: ViewPager? = null
constructor(context: Context) : super(context)
@Middleware()
export class MulterMiddleware implements NestMiddleware {
resolve(): (req, res, next) => void {
const upload = multer({ dest: "" });
return upload.any();
}
}
@Module({
modules: [DatabaseModule, HttpExceptionModule, LoggerModule, StorageModule],
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.2">
<description></description>
<groupId>15ada4b2-016d-1000-5082-9ad39d94fbb1</groupId>
<name>SUM</name>
<snippet>
<connections>
<id>153e5470-27c9-376a-0000-000000000000</id>
<parentGroupId>9420f1f3-b071-33b3-0000-000000000000</parentGroupId>
<backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 customer_id, -500 value,
DATE '2019-10-12' timestamp UNION ALL
SELECT 1, -300, '2019-10-11' UNION ALL
SELECT 1, -200, '2019-10-10' UNION ALL
SELECT 2, 200, '2019-09-10' UNION ALL
SELECT 2, 100, '2019-08-10' UNION ALL
SELECT 2, 50, '2019-07-10' UNION ALL
SELECT 1, 600, '2019-09-02'
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWFxYBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/CABEIAyAEsAMBIgACEQEDEQH/xAAdAAACAgMBAQEAAAAAAAAAAAABAgADBAUGBwgJ/9oACAEBAAAAAMF7K97OK6oK8jKzZeTXZhBCHWxXV48IZiqQgoJKtdsyYEiKvPc3idr5B6D2udqvG8Ld+10UeV7To681qglMget6KgVUhwHEURLVUmLI1Yqw9drNx1phUw1KudXS5lb14HTLdTvLuI61CDHUWZOVU9Fdbwx0JsLOoJJDRYJANdsQIjQCrRcxg9p5H3vbburw3T7/ANuxKPJdr065DgVKsUiDGEQqwBjKgivVMhQCBFXC1um2vbWUAswrQbCpXUKa9du4E39vGdLYCQwLZOWrYyQPFYFwZYFYyQspNgCYOe9REWSvScxrO28o9G6/cjwPTdN7Bit5VsuqGUKwmPGjpdipVSzqGrMZSKLYjFwpapjjYuq0G77m2hWBCI2dKijgprcmPVvb+O6UvHdLIuXnVnA4Xl8Na1qgptqqRKSEhrMu6fe1uuNcaYmLiYUxacOrodT0e0jcxiZnTrdzlu2N7lY73MGuowqYstZr6uWxhGsdrbbbntey+ZCTW6bf95YlUMCrNmlcau2tdaI022Tx/VFYXYyy7YjXeB8eKq0iVisKqisMTU6pL7wVUsGgCFUamywOHjV2KxEtrLGOjMCGxtcoqsUPDjyBpAZDFj1hxLNj6P7DlkyKhmdUt1bl69XhNbTucrk+oVJbCxbK2uL4J5rsatUkNRArNdlauVUxBU6EqIVjiBootQSM8YMyMRCyixDIShataQAId
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.