Skip to content

Instantly share code, notes, and snippets.

View scrubmx's full-sized avatar
🏴‍☠️

Jorge González scrubmx

🏴‍☠️
View GitHub Profile
@scrubmx
scrubmx / InteractsWithElements.php
Created November 1, 2017 23:20
Facebook\WebDriver\Exception\UnknownServerException: unknown error: Element is not clickable at point
<?php
namespace Laravel\Dusk\Concerns;
use Exception;
use Facebook\WebDriver\WebDriverKeys;
trait InteractsWithElements
{
/**
@scrubmx
scrubmx / Application.php
Created October 25, 2017 23:18
Register custom model events in laravel 5.5
<?php
namespace App\Models;
class Application extends Model
{
/**
* The attributes that should be mutated to dates.
*
* @var array
@scrubmx
scrubmx / CreatesApplication.php
Created September 1, 2017 19:17
Use a stub log driver in your laravel tests
<?php
namespace Tests;
use Illuminate\Foundation\Application;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
@scrubmx
scrubmx / converter.php
Last active August 22, 2017 20:02
Convert html string to markdown
<?php
class MarkdownConverter
{
protected = $original;
protected = $formatted;
public function convert(string $html)
{
$this->original = $html;
@scrubmx
scrubmx / _analytics.blade.php
Created March 15, 2017 16:46
Google analytics blade partial for laravel.
<script>
(function (i,s,o,g,r,a,m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
};
i[r].l = 1*new Date();
a = s.createElement(o);
m = s.getElementsByTagName(o)[0];
a.async = 1;
@scrubmx
scrubmx / TestCase.php
Created March 13, 2017 16:29
Laravel authorization test helpers
<?php
namespace Tests;
use Illuminate\Contracts\Auth\Access\Gate;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
@scrubmx
scrubmx / deploy.sh
Last active August 22, 2017 20:05
Laravel deploy script
# Change to the project directory
cd /home/forge/appname.com
# Put the application into maintenance mode
php artisan down
# Get the latests changes
git pull origin master
# Install composer dependecies
  • Dynamic Dispatch
  • Dynamic Method
  • Ghost Methods
  • Dynamic Proxies
  • Blank Slate
  • Kernel Method
  • Flattening the Scope (aka Nested Lexical Scopes)
  • Context Probe
  • Class Eval (not really a 'spell' more just a demonstration of its usage)
  • Class Macros
@scrubmx
scrubmx / Banner.php
Last active April 7, 2017 05:30
Banners
<?php
class Banner {
protected $image;
protected $url
public function __construct($image, $url)
{
$this->image = $image;
$this->url = $url;
@scrubmx
scrubmx / nightwatch.conf.js
Last active March 3, 2020 18:57
nightwatch config example
module.exports = {
"src_folders": [
"tests/nightwatch" // Where you are storing your Nightwatch e2e/UAT tests
],
"output_folder": "./reports", // reports (test outcome) output by nightwatch
"selenium": { // downloaded by selenium-download module (see readme)
"start_process": true, // tells nightwatch to start/stop the selenium process
"server_path": "/usr/local/bin/selenium-server-standalone.jar",
"host": "127.0.0.1",
"port": 4444, // standard selenium port