Skip to content

Instantly share code, notes, and snippets.

@SergeyMell
SergeyMell / s3_sync_service.rb
Last active January 18, 2017 19:35
Inspired by https://gist.github.com/bantic/4080793. A ruby class to copy files from one AWS S3 bucket to another one supporting aws-sdk v.2
require 'aws-sdk'
class S3SyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
# from_credentials and to_credentials are both hashes with these keys:
# * :access_key_id
# * :secret_access_key
@SergeyMell
SergeyMell / test.ts
Created August 31, 2017 08:49
Angular 4 karma test configuration
import 'babel-polyfill/dist/polyfill.js';
import 'zone.js/dist/zone.js';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
@SergeyMell
SergeyMell / ngsw-config.json
Last active November 16, 2017 09:56
Configuration file for Service Worker in Angular applications
{
"index": "/index.html",
"appData": {
"name": "Angular Service Worker Example",
"description": "Example of Angular v5 application utilizing SW functionality"
},
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
@SergeyMell
SergeyMell / image_with_preview_input.rb
Created February 17, 2018 22:31
Formtastic extension of file inputs to make them as inputs with image preview
class ImageWithPreviewInput < Formtastic::Inputs::FileInput
def to_html
options.merge!(hint: preview_html.html_safe)
super + "<script>#{preview_script}</script>".html_safe
end
private
def preview_html
webpackJsonp(["main"],{
/***/ "./src/$$_lazy_route_resource lazy recursive":
/***/ (function(module, exports, __webpack_require__) {
var map = {
"./badges/badges.module": [
"./src/app/main/kid/rewards/badges/badges.module.ts",
"badges.module"
],
{
"extends": "gts/tslint.json",
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
{
"extends": "stylelint-config-primer",
"plugins": [
"stylelint-scss"
],
"rules": {
"indentation": 4,
"selector-max-type": null
}
}
import { INestApplication } from '@nestjs/common';
export async function setupAdminPanel(app: INestApplication): Promise<void> {
}
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { setupAdminPanel } from './admin-panel/admin-panel.plugin';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
/**
* Setup Admin panel
import { INestApplication } from '@nestjs/common';
import AdminBro from 'admin-bro';
import * as AdminBroExpress from 'admin-bro-expressjs';
export async function setupAdminPanel(app: INestApplication): Promise<void> {
/** Create adminBro instance */
const adminBro = new AdminBro({
resources: [], // Here we will put resources
rootPath: '/admin', // Define path for the admin panel