Skip to content

Instantly share code, notes, and snippets.

View DarkGhostHunter's full-sized avatar
👨‍💻
Hands full

Italo DarkGhostHunter

👨‍💻
Hands full
View GitHub Profile
@DarkGhostHunter
DarkGhostHunter / main.go
Created October 27, 2020 04:46
Pinging sites using goroutines
package main
import (
"fmt"
"os/exec"
"strings"
"sync"
)
func isSiteDown(site string, group *sync.WaitGroup) {
@DarkGhostHunter
DarkGhostHunter / main.go
Created October 27, 2020 03:09
Simple iterator system
package main
import "fmt"
type KeyChain struct {
labels []string
keys []string
lock []string
}
<?php
namespace App\Http\Controllers;
use App\Template;
class TemplateController extends Controller
{
/**
* Create a new contract.
<?php
class SecureJSON
{
public $array;
public $key;
public function __construct(array $array)
{
@DarkGhostHunter
DarkGhostHunter / Request.php
Last active July 9, 2020 05:09
Container example
<?php
class ExampleController
{
/**
* The new way
*
* @param Transport $transport
* @param Package $package
* @param Weather $weather
@DarkGhostHunter
DarkGhostHunter / Container.php
Created July 9, 2020 04:44
Container class to pass through the next method.
<?php
class Container
{
protected $target;
protected $value;
public function __construct($target, $value)
{
$this->target = $target;
@DarkGhostHunter
DarkGhostHunter / Throttler.php
Last active February 10, 2023 10:58
A class that throttles it's target methods calls.
<?php
namespace App\Throttler;
use Illuminate\Cache\RateLimiter;
class Throttler
{
/**
* Target to rate limit.
@DarkGhostHunter
DarkGhostHunter / ThrottlesCalls.php
Last active June 2, 2020 04:15
Simple Trait to throttle method calls.
<?php
namespace App\Throttler;
trait ThrottlesCalls
{
/**
* Throttles the next method call.
*
* @param int $tries
@DarkGhostHunter
DarkGhostHunter / layout.blade.php
Created March 17, 2020 19:28
Main App Layout
<!doctype html>
<html lang="{{ config('app.locale') }}">
<head>
@include('web.layout.head')
</head>
<body>
<header>
@include('web.layout.header')
</header>
<main>
@DarkGhostHunter
DarkGhostHunter / Enumerate.php
Created March 13, 2020 20:33
A nice class that enumerates values
<?php
class Enumerate
{
/**
* Current state of the enumerated object.
*
* @var string
*/
protected $current;