Skip to content

Instantly share code, notes, and snippets.

View MinecraftServer.java
package no.jckf.slplib;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.nio.charset.Charset;
public final class MinecraftServer {
private String address = "localhost";
@codyphobe
codyphobe / unfave.rb
Created Feb 15, 2020 — forked from robinsloan/unfave.rb
Unfave script, because why not??
View unfave.rb
#!/usr/bin/env ruby
require "rubygems"
require "twitter"
require "json"
require "faraday"
# things you must configure
TWITTER_USER = "your_username"
# get these from dev.twitter.com
@codyphobe
codyphobe / langoliers.rb
Created Feb 15, 2020 — forked from robinsloan/langoliers.rb
Tweet delete script
View langoliers.rb
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@codyphobe
codyphobe / SingletonModel.php
Created Feb 15, 2020 — forked from mpociot/SingletonModel.php
Making it easier to work with single row models in Laravel
View SingletonModel.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SingletonModel extends Model
{
protected function store($data = [])
{
@codyphobe
codyphobe / isSunUp.php
Last active Feb 28, 2020 — forked from bramus/isSunSup.php
A standalone PHP function to check whether or not the Sun is above the horizon in a given location and time
View isSunUp.php
<?php
function isSunUp(\DateTime $when, $lat, $lon): bool
{
$whenTimestamp = $when->getTimestamp();
[$sunriseTimestamp, $sunsetTimestamp] = array_map(function ($f) use ($whenTimestamp, $lat, $lon) {
return $f($whenTimestamp, SUNFUNCS_RET_TIMESTAMP, $lat, $lon);
}, ['date_sunrise', 'date_sunset']);
@codyphobe
codyphobe / HasUuid.php
Created Jul 10, 2018 — forked from calebporzio/HasUuid.php
A little trait to add to models that will have Uuids
View HasUuid.php
<?php
// Example usage in a model:
class ExampleModel extends Model
{
use HasUuid;
protected $primaryKey = 'uuid';
@codyphobe
codyphobe / in-memory-sqlite-database.php
Created Sep 26, 2017 — forked from reinink/in-memory-sqlite-database.php
Give users completely safe sandboxed raw SQL reporting abilities
View in-memory-sqlite-database.php
<?php
// Create in-memory SQLite database
$sqlite = new PDO('sqlite::memory:');
// Generate schema (for whatever tables you want)
$sqlite->prepare('CREATE TABLE users(id, family_id, first_name, last_name, email)')->execute();
$sqlite->prepare('CREATE TABLE families(id, name, phone, address)')->execute();
// Insert pre-defined data
@codyphobe
codyphobe / _readme.md
Created Aug 15, 2017 — forked from BenTech2/_readme.md
PretendYoureXyzzy Server Installation
View _readme.md

WARNING: This guide is still being written... after 3 days of research and trial/error i have setup a working server and now am shareing the process since theres no documentation on the internet for it.

How To Setup a PretendYoureXyzzy Server

Ubuntu 14.04 Server or Desktop

NOTE - you will need a linux (or M$ windows, but i could not get it tomcat emulator to work) GUI environment for eclipse to build the WAR file for the server, unless you plan to use Ubuntu Desktop for the server.

Setup the Tomcat Server

@codyphobe
codyphobe / delete-all-discord-messages.js
Created Aug 1, 2017
Deleting every message from a channel using DiscordJS
View delete-all-discord-messages.js
const client = new Discord.Client();
client.on('message', msg => {
let deleteStuff = () => {
let count = 0;
msg.channel.fetchMessages({limit: 100})
.then(messages => {
let messagesArr = messages.array();
let messageCount = messagesArr.length;
@codyphobe
codyphobe / SearchThreads.php
Created Jul 20, 2017 — forked from driesvints/SearchThreads.php
Multiple method query objects
View SearchThreads.php
<?php
namespace App\Queries;
use App\Models\Thread;
use Illuminate\Contracts\Pagination\Paginator;
class SearchThreads
{
public function __construct()