Skip to content

Instantly share code, notes, and snippets.

@andreybleme
andreybleme / Sublime Preferences
Created May 16, 2014 14:54
Preferences and personal configuration (from my sublime text 2)
[
{ "keys": ["f12"], "command": "reindent"} //auto-indent F12
]
@andreybleme
andreybleme / httpd.conf
Created August 1, 2015 16:05
Apache configuration for URL rewriting
- This will be commented and must be uncommented to load the rewrite module
LoadModule rewrite_module modules/mod_rewrite.so
- This block will be different, making impossible to AllowOverride, chage thise lines for the lones below
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
@andreybleme
andreybleme / dandelion.yml
Created April 4, 2015 21:06
Dandelion s3 adapter for AWS buckets
adapter: s3
bucket_name: queen-fantasia
access_key_id: my_key_id
secret_access_key: my_secret_access_key
host: s3-sa-east-1.amazonaws.com
exclude:
- .gitignore
- dandelion.yml
@andreybleme
andreybleme / eclipse.ini
Created June 22, 2016 18:14
Eclipse file to fix the bug on Ubuntu 16.04. If it doesn't work, change the line 19 to use version 1.8.
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.300.v20150602-1417
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
@andreybleme
andreybleme / functional.js
Last active November 19, 2016 17:19
Exemplo de utilização do paradigma funcional em um filter do Vue 2.0.
computed: {
filteredThings () {
return this.things
.filter(contains(this.foo))
.sort(by(thing => thing.bar))
.slice(0, 10)
}
}
public class Boxes {
public static int minimalNumberOfBoxes(int products, int availableLargeBoxes, int availableSmallBoxes) {
int smallBoxes = products % (availableLargeBoxes * 5);
int bigBoxes = products - (smallBoxes * 5);
if (((availableLargeBoxes * 5) + availableSmallBoxes) < products) {
return -1;
}
return (bigBoxes + smallBoxes) * -1;
@andreybleme
andreybleme / header.json
Created April 1, 2017 14:14
andreybleme.com | JWTs com Springboot
{
"alg": "HS256",
"typ": "JWT"
}
@andreybleme
andreybleme / payload.json
Created April 1, 2017 14:27
andreybleme.com | JWT com Springboot
{
"sub": "1337",
"name": "Lucas Bleme",
"admin": true
}
@andreybleme
andreybleme / signature.js
Created April 1, 2017 14:49
andreybleme.com | JWT com Springboot
HMACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
secret)
@andreybleme
andreybleme / JwtmeApplication.java
Created April 1, 2017 15:14
andreybleme.com | JWT com Springboot
package com.jwtme;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController