Skip to content

Instantly share code, notes, and snippets.

View i07's full-sized avatar
🏆
engineering

Marc Donkers i07

🏆
engineering
View GitHub Profile
package donkers.tutorial.medium
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.web.client.TestRestTemplate
import org.springframework.boot.web.server.LocalServerPort
package donkers.tutorial.medium
import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest
@SpringBootTest
class TutorialRestApiApplicationTests {
@Test
fun contextLoads() {
package donkers.tutorial.medium
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime
data class StatusObject(var timestamp:LocalDateTime, var message:String) {
@i07
i07 / catchNonLaunch.swift
Created January 3, 2016 11:42
catch handleNonLaunchSpecificActions exception
import UIKit
extension UIApplication {
func _handleNonLaunchSpecificActions(arg1: AnyObject, forScene arg2: AnyObject, withTransitionContext arg3: AnyObject, completion completionHandler: () -> Void) {
//whatever you want to do in this catch
print("handleNonLaunchSpecificActions catched")
}
}
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
 
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
 
@i07
i07 / validate_ip.js
Last active August 29, 2015 14:13
Validate an IP
function validate_ip(ipaddr)
{
if (/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/.test(ipaddr))
return true;
return false;
}
usage:
<script>