Skip to content

Instantly share code, notes, and snippets.

View bioyeneye's full-sized avatar
🎯
Building it

Bolaji Oyeneye bioyeneye

🎯
Building it
View GitHub Profile
@bioyeneye
bioyeneye / AsyncImplementation.java
Created October 29, 2018 05:16 — forked from cutiko/AsyncImplementation.java
How to use Retrofit in Android
public clas AsyncImplementation extends AsyncTask<Void, Void, Void> {
/*Please read the rest of the explanation in the DefaultImplementation.java file. The difference between a default http request
and one using an AsyncTask is the enqeue() or the .execute() method*/
/*If you are passing params to the url, like it would be the case of the method post(long theDynamicParameter) you can
do it using replacing the void in the AsyncTask, in this case we are passing a Map so is passed in the constructor. Some times,
you would want the AsyncTask solve all the logic, then implements methods here to do it. Create the request http in a loop.
Use getter and setter to extends this to another class, etc.
Now in activity you can new AsyncImplementation(map).execute();*/
export class BaseComponent {
public scope: ComponentScope;
constructor() {
}
}
@bioyeneye
bioyeneye / GenericHttpClientService.ts
Last active September 10, 2018 10:28
Generic Http Client Service
import { Injectable , Component} from '@angular/core';
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Observable } from 'rxjs';
import {AuthServiceJwt} from '../Common/sevice.auth.component';
@Injectable()
export class GenericHttpClientService {
private readonly baseUrl : string = "**********";
@bioyeneye
bioyeneye / AppModule
Last active September 10, 2018 10:24
angular 6 Request Interceptor
import { TokenInterceptor } from './auth/token.interceptor';
@NgModule({
declarations: [],
imports: [],
exports: [],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
@bioyeneye
bioyeneye / MimeTypes.php
Created March 27, 2018 08:40 — forked from nimasdj/MimeTypes.php
List of MimeTypes mapped to file extensions
<?php
// I made this array by joining all the following lists + .php extension which is missing in all of them.
// please contribute to this list to make it as accurate and complete as possible.
// https://gist.github.com/plasticbrain/3887245
// http://pastie.org/5668002
// http://pastebin.com/iuTy6K6d
// total: 1223 extensions as of 16 November 2015
$mime_types = array(
'3dm' => array('x-world/x-3dmf'),
'3dmf' => array('x-world/x-3dmf'),
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Session;
use Illuminate\Support\Facades\Redirect;
use DB;
use Illuminate\Support\Facades\Storage;

CSV Seeder

Seed your database with CSV files

This package allows CSV based seeds.

Installation

@bioyeneye
bioyeneye / Application_Start.cs
Created February 27, 2018 09:25
Autofac + MVC + RP + UOW
//Autofac Configuration
using Autofac.Integration.Mvc;
using Autofac;
var builder = new Autofac.ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly).PropertiesAutowired();
builder.RegisterModule(new RepositoryModule());
@bioyeneye
bioyeneye / AuditableEntity.cs
Created February 27, 2018 09:19
C# Repository + UOW. Cache is not included
public abstract class AuditableEntity<T> : Entity<T>, IAuditableEntity
{
[ScaffoldColumn(false)]
public DateTime CreatedDate { get; set; }
[MaxLength(256)]
[ScaffoldColumn(false)]
public string CreatedBy { get; set; }
@bioyeneye
bioyeneye / UnitOfWork.cs
Created February 27, 2018 09:00 — forked from azborgonovo/UnitOfWork.cs
Creating the 'best' Unit of Work and Repository implementation on C#
// Basic unitOfWork pattern as described by Martin Fowler (http://martinfowler.com/eaaCatalog/unitOfWork.html)
// Other methos as 'registerNew' are going to be managed by each repository
public interface IUnitOfWork : IDisposable
{
void Commit();
Task CommitAsync();
void Rollback();
}
public interface IUnitOfWorkFactory