This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
html, | |
body { | |
padding: 0; | |
margin: 0; | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('getUserIP')) { | |
function getUserIP() | |
{ | |
foreach (array('HTTP_CF_CONNECTING_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { | |
if (array_key_exists($key, $_SERVER) === true) { | |
foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) { | |
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tech.otter.servicename; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@SpringBootApplication | |
@RestController | |
public class Application { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PlayerController : MonoBehaviour { | |
// Update is called once per frame | |
void Update () { | |
this.transform.Translate(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * Time.deltaTime); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn unfortunate typos into dad joke opportunities, courtesy of @GonzoHacker | |
git config --global alias.dad '!curl -w "\n" https://icanhazdadjoke.com/ && git add' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Expects input in the standard format- 1d6+2 or 1d12-1 or 4d4 | |
*/ | |
function roll(dieCode) { | |
var total = 0; | |
var results = dieCode.match(/([0-9]+)d([0-9]+)([\-\+][0-9]+)?/); | |
if(results !== null) { | |
for(var i = 0; i < parseInt(results[1]); i++) { | |
total += Math.floor(Math.random() * parseInt(results[2])) + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CargoScreen extends View { | |
private VisList<ItemEntry> lstItems; | |
private VisImage imgItem; | |
private VisTextArea txtDescription; | |
private VisTextButton btnBack; | |
public CargoScreen(Controller parent, Model model) { | |
super(parent, model); | |
// Initialize the image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Java | |
*.class | |
*.war | |
*.ear | |
hs_err_pid* | |
## Robovm | |
robovm-build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw a background | |
private void drawBackground() { | |
// To simplify the code a little, do these calculations ahead of time | |
// To speed things up, we might optimize this. | |
float cameraLeft = camera.position.x - camera.viewportWidth / 2f; | |
float cameraRight = camera.position.x + camera.viewportWidth / 2f; | |
float cameraTop = camera.position.y + camera.viewportHeight / 2f; | |
float cameraBottom = camera.position.y - camera.viewportHeight / 2f; | |
float width = background.getWidth(); |