Skip to content

Instantly share code, notes, and snippets.

import {HttpException, Injectable} from '@nestjs/common';
import {google} from 'googleapis';
import {GoogleApiService} from '../googleApi/googleApi.service';
@Injectable()
export class GoogleSheetService {
constructor(private readonly googleApiService: GoogleApiService) {}
async readSheet(): Promise<any[]> {
@sofyan-ahmad
sofyan-ahmad / aws-amplify-react-native.d.ts
Last active March 24, 2021 14:31
aws amplify react native typescript definition
declare module 'aws-amplify-react-native' {
const Amplify: any;
export default Amplify;
// *** UI ***
interface ITheme {
container: {};
section: {};
sectionHeader: {};
sectionHeaderText: {};
@sofyan-ahmad
sofyan-ahmad / permissions.js
Created March 24, 2021 03:38
Strapi.io - cache graphql query request with custom api token and check user permission before return value from cache
// strapi/extensions/users-permissions/config/policies/permissions.js
const _ = require('lodash');
const crypto = require('crypto');
const redisClient = require('../../../../cache/redis');
const handleErrors = (ctx, err = undefined, type) => {
throw strapi.errors[type](err);
};
@sofyan-ahmad
sofyan-ahmad / YourModel.js
Created March 24, 2021 03:51
Strapi.io - Cache strapi on service level
// strapi/api/${YourModel}/services/${YourModel}
const crypto = require('crypto');
const redisClient = require('../../../cache/redis');
const sendNotification = require('./notification');
/**
* Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services)
* to customize this service
*/
@sofyan-ahmad
sofyan-ahmad / print_repo_urls.bash
Created May 31, 2022 05:16
Gitlab: Print all repos under a group
for repo in $(curl -s --header "PRIVATE-TOKEN: YOUR_TOKEN" "https://gitlab.com/api/v4/groups/YOUR_GROUP?include_subgroups=true&per_page=100" | jq -r ".projects[].http_url_to_repo"); do echo $repo; done;