Skip to content

Instantly share code, notes, and snippets.

@1e4
1e4 / pve.php
Created December 5, 2020 04:12
Simple turn based PvE script
<?php
$monster = [
'health' => 100,
'aps' => 1.3,
'damage' => 40
];
$player = [
'health' => 1000,
@1e4
1e4 / map_generator.php
Last active June 28, 2019 23:10
Tiled map generator
<?php
class TSX {
/**
* Holds the map indexed by tile GID
*
* @var array
*/
private $map = [];
@1e4
1e4 / gravatar.js
Last active September 27, 2018 10:01
Gravatar in Javascript, md5 is optional
// Usage
let g = new Gravatar;
return g.setEmail('your_email')
.setRating('x')
.setSize(40)
.setImageSet('monsterid')
.getAvatar()
<?php
namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
class TimerCheck
{
/**
@1e4
1e4 / CountryExists.php
Created April 14, 2018 12:01
Laravel Country Validation
<?php
// app/Rules/CountryExists.php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class CountryExists implements Rule
{
@1e4
1e4 / countrylist.php
Created April 14, 2018 11:36 — forked from princenaman/countrylist.php
ISO Country List for Laravel
<?php
return [
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
@1e4
1e4 / .bash_profile
Created December 7, 2017 15:55
Quick bash script for changing local git repo config settings
function gitconfig {
if [ "$1" == "" ]; then
echo "Empty username (Usage gitconfig username email)"
else
git config user.name "$1"
echo "Set git username to $1"
fi
@1e4
1e4 / id_issue.py
Created July 19, 2017 08:27
Razer taking over focus for no reason!
#!/usr/bin/python
from AppKit import NSWorkspace
import time
t = range(1,100)
for i in t:
time.sleep(3)
activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName']
print activeAppName
@1e4
1e4 / gulpfile.js
Last active August 29, 2015 14:27 — forked from darkwing/gulpfile.js
var gulp = require('gulp');
var runSequence = require('run-sequence');
var minifyCss = require('gulp-minify-css');
var buildDir = './build/';
var minifyCssSettings = { advanced: true, aggressiveMerging: true };
// Main build
gulp.task('build', function() {
@1e4
1e4 / Twig Errors
Last active August 29, 2015 14:11
#Twig Field Errors
Currently there was no easy way of adding errors to a standard twig / laravel build, so I created a quick filter and thought I would share, nothing crazy but hopefully someone else might find it useful.
##Install
Copy the below code into `lwig.php` within the extensions directory, if you don't have one follow the quick step below
#####If no extension directory:
* Create a directory under `app/` named `lextra` (or whateer you want).
* In your composer make sure you are autoloading that directory `"app/lextra"`.
* Run `composer dumpautoload` to generate the autoload file