Skip to content

Instantly share code, notes, and snippets.

View enif-lee's full-sized avatar
😁

enif.lee enif-lee

😁
View GitHub Profile
@enif-lee
enif-lee / AwsS3Helper.cs
Created October 2, 2019 07:19
Upload multipart to AWS S3 Object in .NET Core 3.0
public static class AwsS3Helper
{
public static async Task UploadObjectStreamAsync(
this IAmazonS3 s3Client,
Stream stream,
UploadStreamToS3Request request)
{
async IAsyncEnumerable<UploadPartResponse> UploadAsync(string uploadId)
{
await foreach (var (partStream, index, isLast) in SplitPartsFromStream(stream, request.ParSize))
@enif-lee
enif-lee / one-dark-deep.xml
Last active November 20, 2019 11:50
Jetbrains One Dark Deep Theme - Material Theme Plugin
<mtTheme>
<id>one-dark-deep</id>
<editorColorsScheme>one-dark-deep</editorColorsScheme>
<dark>true</dark>
<name>one-dark-deep</name>
<colors>
<color id="background" value="1c1f25ff"/>
<color id="foreground" value="b0b9bdff"/>
<color id="text" value="9ba5a8ff"/>
<color id="highlight" value="3e4a5dff"/>
@enif-lee
enif-lee / ValidateModelAttribute.cs
Last active February 1, 2019 02:55
ASP.NET MVC Empty Body Filter
namespace Application.Infrastructures.Filters
{
public class ValidateModelAttribute : ActionFilterAttribute
{
private readonly ConcurrentDictionary<string, IList<string>> _bodyParameters = new ConcurrentDictionary<string, IList<string>>();
public override void OnActionExecuting(HttpActionContext actionContext)
{
base.OnActionExecuting(actionContext);
var request = actionContext.Request;
@enif-lee
enif-lee / build.sbt
Created May 31, 2017 05:45
build.sbt for "Programming Scala" book
name := "programming-scala"
version := "1.0"
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-swing" % "2.11+",
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.3",
"com.typesafe.akka" %% "akka-actor" % "2.4.1",
@enif-lee
enif-lee / last-connected-time.pipe.ts
Last active May 14, 2017 08:08
Last connected time pipe for angular
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'lastConnectedFormat' })
export class LastConnectedTimeFormatPipe implements PipeTransform {
transform(connectedTime: Date, ...args): string {
let elapsed = new Date(new Date().getTime() - connectedTime.getTime()).getTime() / 60000;
let time: string = '';
if (elapsed < 60) {
@enif-lee
enif-lee / base-common-request.options.ts
Created April 25, 2017 15:08
how to set base url in angular
import { BaseRequestOptions, Headers, RequestOptions, RequestOptionsArgs } from '@angular/http';
import { Injectable } from '@angular/core';
@Injectable()
export class BaseCommonRequestOptions extends BaseRequestOptions {
merge(options?: RequestOptionsArgs): RequestOptions {
return new CommonRequestOptions(super.merge(extracted(options)));
}
}
git config --global alias.st status
git config --global alias.br branch
git config --global alias.co checkout
git config --global alias.cm "commit -m "
git config --global alias.l 'log --color --graph --pretty=oneline --decorate --date=short --abbrev-commit --branches'
git config --global alias.ds 'diff --stat'
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
git config --global difftool.prompt false
@enif-lee
enif-lee / router.js
Last active February 8, 2017 01:14
router.js
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import {Message} from 'element-ui'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
var routes = {
root: {
@enif-lee
enif-lee / vue.js
Created February 7, 2017 14:55
vue.js router guard
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
const router = new VueRouter({
routes: [
{
@enif-lee
enif-lee / vue.js
Created February 7, 2017 14:55
vue.js router guard
import Vue from 'vue'
import VueRouter from 'vue-router'
import firebase from 'firebase'
import signIn from './sign-in.vue'
Vue.use(VueRouter);
const router = new VueRouter({
routes: [
{