Skip to content

Instantly share code, notes, and snippets.

How to add a start and exit portal
Make an exit portal in your game they can walk/fly/drive into, you can add a label like Vibe Jam Portal. This way players can play and go to the next game like a Vibe Jam 2026 Webring! Your game will be added if you have a portal.
And if they enter the portal it should redirect the page here (if it doesn't work yet no worries, I am building it then, will work when deadline hits! :D)
https://vibejam.cc/portal/2026
You can send GET query params (like ?username=bla&color=red&speed=0.2&ref=bla.com) that get forwarded like:
- username= (username/name of player)
- color= (color of player in hex or just red/green/yellow)
@MartinTale
MartinTale / HasCompositePrimaryKeyTrait.php
Created December 18, 2019 02:10
Laravel trait to support composite primary keys in Eloquent models..
<?php
namespace App\Traits;
use Exception;
use Illuminate\Database\Eloquent\Builder;
trait HasCompositePrimaryKeyTrait
{
/**
@MartinTale
MartinTale / slugToHumanReadable.php
Created December 17, 2019 16:04
Converts slug to human readable string..
<?php
if (!function_exists('slugToHumanReadable')) {
function slugToHumanReadable($slug)
{
return ucwords(str_replace('-', ' ', $slug));
}
}
@MartinTale
MartinTale / numberWithSign.php
Created December 17, 2019 15:46
PHP function that converts number to a number with sign in front of it..
<?php
if (! function_exists('numberWithSign'))
{
function numberWithSign($number)
{
if ($number < 0) {
return round($number, 2);
} else {
return '+' . round($number, 2);
@MartinTale
MartinTale / isDate.php
Created December 17, 2019 15:44
PHP functions that validates that the given string is a date..
<?php
if (! function_exists('isDate'))
{
function isDate($string)
{
if (DateTime::createFromFormat('Y-m-d', trim($string)) !== FALSE) {
return true;
}
@MartinTale
MartinTale / hashTagToLink.php
Last active December 17, 2019 15:41
Laravel helper function that turn hashtags in a string into links..
@MartinTale
MartinTale / floatToTime.php
Last active December 17, 2019 15:37
PHP function that converts float number to time..
<?php
if (! function_exists('floatToTime')) {
function floatToTime($time, $long = false)
{
$minutes = fmod($time, 1) * 60;
$units = [
'm' => 'm',
'h' => 'h',
/**
* Escape special characters in the given string of html.
*
* @param {String} html
* @return {String}
*/
module.exports = {
escape: function(html) {
return String(html)
.replace(/&/g, '&amp;')
@MartinTale
MartinTale / webpack.config.js
Last active February 1, 2016 13:06
webpack.config.js
var webpack = require('webpack');
module.exports = {
debug: true,
entry: './src/index.js',
output: {
path: '.',
filename: "test-package.js"
},
module: {
@MartinTale
MartinTale / webpackBootstrap.js
Created February 1, 2016 13:03
webpackBootstrap
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;