Skip to content

Instantly share code, notes, and snippets.

View thabofletcher's full-sized avatar

Thabo Fletcher thabofletcher

View GitHub Profile
#!/bin/sh
git stash
git pull
git push
git stash apply
ngAnnotate: {
options: {
remove: true,
add: true,
singleQuotes: true
},
js: {
files: [
{
expand: true,
IntStream.range(0, items.length)
.parallel()
.forEach(i -> {
String messageBody = messages.get(i).getBody();
try {
items[i] = mapper.readValue(messageBody, type);
} catch (IOException e) {
e.printStackTrace();
}
});
List<IOException> deserializationErrors = new ArrayList<IOException>();
IntStream.range(0, items.length)
.parallel()
.forEach(i -> {
String messageBody = messages.get(i).getBody();
try {
items[i] = mapper.readValue(messageBody, type);
} catch (IOException e) {
deserializationErrors.add(e);
}
@thabofletcher
thabofletcher / index.php
Last active March 30, 2016 09:22
sanitize all dangerous superglobals
foreach ($_GET as $key => $value) {
$_GET[$key] = filter_input(INPUT_GET, $key, FILTER_SANITIZE_STRING);
}
foreach ($_POST as $key => $value) {
$_POST[$key] = filter_input(INPUT_POST, $key, FILTER_SANITIZE_STRING);
}
foreach ($_COOKIE as $key => $value) {
$_COOKIE[$key] = filter_input(INPUT_COOKIE, $key, FILTER_SANITIZE_STRING);