Skip to content

Instantly share code, notes, and snippets.

View paztek's full-sized avatar

Matthieu Balmes paztek

View GitHub Profile
@paztek
paztek / ViewController.m
Created March 25, 2014 20:17
Allows videos to rotate in landscape when displayed in a portrait only iOS app
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// We configure the video player to play a remote video
NSURL *movieURL = [NSURL URLWithString:@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];
@paztek
paztek / AppDelegate.m
Last active June 11, 2019 20:54
Allows videos to rotate in landscape when displayed in a portrait only iOS app
#import "AppDelegate.h"
#import <MediaPlayer/MediaPlayer.h>
@implementation AppDelegate
{
BOOL _isFullScreen;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@paztek
paztek / drink.model.ts
Last active July 17, 2020 22:21
nestjs-ioc-example-1
export interface Drink {
name: string;
alcoholByVolume: number;
}
@paztek
paztek / drink.module.ts
Last active July 17, 2020 23:28
nestjs-ioc-example-2
import { Module, OnModuleInit } from '@nestjs/common';
import { DrinkService } from './drink.service';
import { DiscoveryModule, DiscoveryService } from "@nestjs/core";
import { DRINK_PROVIDER, DrinkProvider } from "./drink.provider";
@Module({
imports: [
DiscoveryModule,
],
@paztek
paztek / drink.service.spec.ts
Created July 17, 2020 23:23
nestjs-ioc-example-3
import { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import { DrinkModule } from './drink.module';
import { SpiritModule } from './spirit/spirit.module';
import { BeerModule } from './beer/beer.module';
import { DrinkService } from './drink.service';
describe('DrinkService', () => {
let app: INestApplication;
@paztek
paztek / app.module.ts
Created July 18, 2020 15:50
nestjs-http-service-example-1
import { Module } from '@nestjs/common';
import { HttpModule } from './http/http.module';
import { FooModule } from './foo/foo.module';
@Module({
imports: [
HttpModule,
FooModule, // <- we'll make use of the "augmented" HttpService in this module
],
@paztek
paztek / app.module.ts
Created July 20, 2020 07:19
nestjs-elasticsearch-example-1
import { Module } from '@nestjs/common';
import { SequelizeModule } from '@nestjs/sequelize';
const logger = new Logger('SQL');
@Module({
imports: [
SequelizeModule.forRoot({
logging: (sql) => logger.log(sql),
dialect: 'mysql',
@paztek
paztek / app.controller.ts
Created July 20, 2020 07:27
nestjs-elasticsearch-example-2
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(
private readonly appService: AppService,
) {}
@paztek
paztek / elasticsearch.module.ts
Created July 20, 2020 07:36
nestjs-elasticsearch-example-3
import { Module, OnModuleInit } from '@nestjs/common';
import { ElasticsearchModule as BaseElasticsearchModule, ElasticsearchService } from '@nestjs/elasticsearch';
import { v4 as uuid }from 'uuid';
@Module({
imports: [
BaseElasticsearchModule.register({
node: 'http://localhost:9200',
generateRequestId: () => uuid(),
}),
@paztek
paztek / elasticsearch.module.ts
Last active July 21, 2020 07:06
nestjs-elasticsearch-example-4
import { Logger, Module, OnModuleInit } from '@nestjs/common';
import { ElasticsearchModule as BaseElasticsearchModule, ElasticsearchService } from '@nestjs/elasticsearch';
import { v4 as uuid }from 'uuid';
@Module({
imports: [
BaseElasticsearchModule.register({
node: 'http://localhost:9200',
generateRequestId: () => uuid(),
}),