<?php

function include_configuration_file($file_path, $languages="all")
{
   if (!file_exists($file_path)) return;

   $content = file($file_path);
   $operations = array("define_in_php", "write_to_javascript_file");

   if ($languages == "all" || $languages == "javascript")
   {
      erase_file_contents(JAVASCRIPT_CONFIG_FILE_PATH);
   }

   switch ($languages)
   {
      case "php":
         return parse_configuration($content, $operations[0]);
      case "javascript":
         return parse_configuration($content, $operations[1]);
      default:
         return parse_configuration($content, $operations);
   }
}

function parse_configuration($body, $operations=NULL)
{
   $operations = (!is_array($operations)) ? array($operations) : $operations;
   foreach ($body as $line)
   {
      if (preg_match("/^ *#.*$/", $line) || trim($line) == "") continue;
      $equality = explode("=", $line, 2);
      $variable = strtoupper(trim($equality[0]));
      $variable = str_replace(" ", "_", $variable);
      $value = trim($equality[1]);
      foreach ($operations as $operation)
      {
         call_user_func($operation, $variable, $value);
      }
   }
}

function write_to_javascript_file($variable, $value)
{
   $equality = "var " . $variable . " = \"" . $value . "\";\n";
   file_put_contents(JAVASCRIPT_CONFIG_FILE_PATH, $equality, FILE_APPEND);
}

function define_in_php($variable, $value)
{
   $GLOBALS[$variable] = $value;
}

function erase_file_contents($file_path)
{
   $fp = fopen($file_path, 'w');
   fclose($fp);
}
<?php
namespace type;

function convert_to_array($item)
{
   if (is_array($item) == False)
   {
      return array($item);
   }

   return $item;
}
<?php
namespace sort;

function quick_sort(array &$array, $comparer=null, $left=0, $right=null)
{
   $right = set_right_index($right, $array);
   if ($right > $left)
   {
      $pivot = calculate_pivot_index($left, $right);
      $new_pivot = partition($array, $comparer, $left, $right, $pivot);
      quick_sort($array, $comparer, $left, $new_pivot - 1);
      quick_sort($array, $comparer, $new_pivot + 1, $right);
   }
}

function set_right_index($index, $array)
{
   if (is_null($index))
   {
      $index = count($array) - 1;
   }
   return $index;
}

function calculate_pivot_index($left_index, $right_index)
{
   $pivot_index = $right_index - ($right_index - $left_index) / 2;
   return $pivot_index;
}

function partition(&$array, $comparer, $left, $right, $pivot_index)
{
   $pivot_value = $array[$pivot_index];
   swap($array, $right, $pivot_index);
   $current = $left;
   for ($ii = $left; $ii < $right; $ii++)
   {
      $comparison = make_comparison($comparer, $array[$ii], $pivot_value);
      if ($comparison === True)
      {
         swap($array, $ii, $current++);
      }
   }
   swap($array, $current, $right);
   return $current;
}

function swap(&$array, $index_1, $index_2)
{
   $value = $array[$index_1];
   $array[$index_1] = $array[$index_2];
   $array[$index_2] = $value;
}

function make_comparison($comparer, $value_1, $value_2)
{
   if (!is_null($comparer))
   {
      $comparison = call_user_func($comparer, $value_1, $value_2);
   }
   else
   {
      $comparison = ($value_1 < $value_2);
   }
   return $comparison;
}
<?php
namespace file;

function count_depth($path)
{
   $stripped_path = trim($path, "/");
   return sizeof(explode("/", $path));
}
<?php

function remove_directory($directory_path, $remove_self=True)
{
   $directory_path = rtrim($directory_path, "/") . "/";
   $directory = opendir($directory_path);
   while ($file = readdir($directory))
   {
      if ($file[0] == '.') continue;
      
      $relative_path = $directory_path . $file;
      if (is_dir($relative_path))
      {
         remove_directory($relative_path);
         continue;
      }
      unlink($relative_path);
   }
   if ($remove_self) rmdir($directory_path);
}
<?php
namespace file;

function is_directory_empty($directory_path)
{
   $files = scandir($directory_path);
   return count($files) > 2;
}
<?php

function print_file_range($fp, $start, $end)
{
   fseek($fp, $start);
   echo "$start - $end\n";
   echo fread($fp, $end-$start) . "\n";
   
}
<?php

function build_path($directory_path, $file_path)
{
   $directory_path = rtrim($directory_path, "/") . "/";
   $path = $directory_path . $file_path;
   return $path;
}
18.232.179.37
18.232.179.37
18.232.179.37
 
July 18, 2022


A new era ‼

Our infrastructure has recently upgraded ‼

Nugget Communications Bureau 👍

You've never emailed like this before ‼

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and I can start our own newspaper or social media feed.

Nugget Streaming Media 👍

The content you crave ‼

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional ‼

Nugget Productivity Suite 👍

Unleash your potential ‼

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security 👍

The real Turing test ‼

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software 👍

The best in gaming entertainment ‼

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom ‼

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.