Skip to content

Instantly share code, notes, and snippets.

defmodule Terraria.IO.WorldFile do
@moduledoc false
import Terraria.BinaryUtils
use Bitwise, only_operators: true
alias Terraria.IO.FileData
alias Terraria.IO.FileMetadata
alias Terraria.IO.WorldFileData
@hastinbe
hastinbe / auto-sellpower.js
Last active April 28, 2017 03:03
Auto-sell power in Reactor Idle
const DEFAULT_SELL_DELAY_IN_SECONDS = 60;
function showReactorMenu() {
$('#reactorsButton').click();
}
function selectReactor(name) {
var reactors = $('.reactorSelect');
var reactor = reactors.find('.description:contains("' + name + '")').parent();
var selectButton = reactor.children('.button');
@hastinbe
hastinbe / gist:fa77f41c68d7a014394f281721450fa4
Created July 14, 2017 20:55 — forked from pmknutsen/gist:7521a29fe8125c24eb3e
HOWTO Run Sia host on Ubuntu server
#HOWTO Run Sia host on Ubuntu server
#Updated: 13 august, 2016
#Tested with Sia 1.0.2 and Ubuntu 16.04
#Update 13.08.2016: Changed from using supervisor to systemd
# Create user `siad`
adduser siad
su siad
*.html diff=html
*.inc diff=php
*.php diff=php
*.phtml diff=php
import curses
import signal
import sys
# Globals
screen = None
refresh_time = 1
class Screen(object):
@hastinbe
hastinbe / gps.php
Last active September 13, 2019 01:37
Gets EXIF GPS data from an image #php #gps
<?php
/**
* GPS helper class.
*
* @package Gps
*
* @author Beau Hastings <[email protected]>
* @copyright 2019 Beau Hastings
* @license GNU GPL v2
*
@hastinbe
hastinbe / container.php
Last active September 13, 2019 01:43
An example of a rudimentary dependency injection container #php #dic
<?php
interface Database {}
class Mysql implements Database {}
class Postgresql implements Database {}
class Container
{
protected $bindings = [];
@hastinbe
hastinbe / bridge-pattern.php
Created September 13, 2019 01:47
Bridge Pattern Example #php #design-patterns #bridge-pattern
<?php
abstract class Window
{
protected $impl;
public function __construct(WindowImpl $impl)
{
$this->setWindowImpl($impl);
}
@hastinbe
hastinbe / composite-pattern.php
Created September 13, 2019 01:48
Composite Pattern Example #php #design-patterns #composite-pattern
<?php
abstract class Component
{
protected $_parent;
protected $_children;
public function __construct()
{
$this->_children = new SplDoublyLinkedList();
}
@hastinbe
hastinbe / decorator-pattern.php
Created September 13, 2019 01:49
Decorator Pattern Example #php #design-patterns #decorator-pattern
<?php
interface IGreeting
{
public function greeting();
}
abstract class GreetingDecorator implements IGreeting
{
protected $greeter;