Skip to content

Instantly share code, notes, and snippets.

View PureSin's full-sized avatar

Kelvin Ma PureSin

View GitHub Profile
@PureSin
PureSin / collector.kt
Created January 22, 2018 05:28
Custom Colelctor
import java.io.BufferedReader
import java.io.File
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import java.util.function.Function
import java.util.function.BiConsumer
import java.util.function.BinaryOperator
import java.util.function.Supplier
import java.util.stream.Collector
@PureSin
PureSin / groupBy.java
Created November 22, 2017 23:17
groupBy
// Compute sum of salaries by department
Map<Intenger, Integer> totalByBucket = nums.stream()
.collect(Collectors.groupingBy(::getBucket, Collectors.summingInt(i)));
@PureSin
PureSin / Example.java
Last active November 22, 2017 22:42
Procedural vs Functional
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Example {
public static void main(String[] args) {
List<Integer> test = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
System.out.println(businessLogic(test));
System.out.println(businessLogicFunctional(test));
what is git?
what is an api?
what is a web server?
what is a compiler?
"""
===========
Description
===========
Simple script to copy and gzip static web files to an AWS S3 bucket. S3 is great for cheap hosting of static web content, but by default it does not gzip CSS and JavaScript, which results in much larger data transfer and longer load times for many applications
When using this script CSS and JavaScript files are gzipped in transition, and appropriate headers set as per the technique described here: http://www.jamiebegin.com/serving-compressed-gzipped-static-files-from-amazon-s3-or-cloudfront/
* Files overwrite old versions