Skip to content

Instantly share code, notes, and snippets.

View LukeHackett's full-sized avatar

Luke Hackett LukeHackett

View GitHub Profile
@LukeHackett
LukeHackett / Application.java
Created September 3, 2019 19:59
CompilerFactoryFactory example
package com.bskyb.demo.janino;
import org.codehaus.commons.compiler.CompilerFactoryFactory;
import org.codehaus.commons.compiler.IExpressionEvaluator;
import java.util.Arrays;
import java.util.List;
public class Application {
@LukeHackett
LukeHackett / download.sh
Created June 19, 2019 10:48
Download a nexus artifact with curl
#!/bin/sh
NEXUS_ENDPOINT="http://nexus.com"
GROUP="com.github.lukehackett"
ARTIFACT="demo-applciation"
VERSION="1.0.0-SNAPSHOT"
REPO="snapshots"
PACKAGING="jar"
curl --silent --location \
package com.example.tinyproxy;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.HttpHostConnectException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import {registerDecorator, ValidationOptions, ValidationArguments, Validator} from "class-validator";
function IsBase64Image(mimeTypes: string[], validationOptions?: ValidationOptions) {
return function (object: Object, propertyName: string) {
registerDecorator({
name: "IsBase64Image",
target: object.constructor,
propertyName: propertyName,
constraints: [mimeTypes],
options: validationOptions,
@LukeHackett
LukeHackett / index.html
Last active March 16, 2017 21:43
Bootstrap 4 (Grid System Only)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>React App</title>
<link rel="stylesheet" type="text/css" href="https://www.sky.com/assets/toolkit/v1.7.0/toolkit.css">
<style type="text/css">
.container {
margin-left: auto;
def require_user
unless current_user
store_location
flash[:danger] = "You must be logged in to access this page"
redirect_to login_path
return false
end
end
def require_no_user