Skip to content

Instantly share code, notes, and snippets.

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

Jorge González scrubmx

🏴‍☠️
View GitHub Profile
  • 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
@scrubmx
scrubmx / subscriptions-report.js
Created September 21, 2016 23:37
PhantomJs Subscriptions Report
var args = require('system').args;
var page = require('webpage').create();
page.viewportSize = { width: 800, height : 400 };
page.content = '<html><body><canvas id="canvas"></canvas></body></html>';
// Load the chartjs lib in the page
page.injectJs('./vendor/chart.js/chart.min.js');
page.evaluate(function (args) {
@scrubmx
scrubmx / helpers.php
Last active September 20, 2016 19:24
Global helper functions
<?php
if (! function_exists('parity')) {
/**
* Return 'even' or 'odd' por the given number.
*
* @param int $number
*
* @return string
*/
@scrubmx
scrubmx / databases.sh
Created September 7, 2016 17:22
Laravel Forge Recipes
mysql -p
expect 'Enter password:'
send 'YOUR_MYSQL_PASSWORD'
# Create the development database
CREATE DATABASE IF NOT EXISTS develop
GRANT ALL ON develop.* TO 'forge'@'localhost'
# Create the production database
CREATE DATABASE IF NOT EXISTS production
@scrubmx
scrubmx / UuidModel.php
Created August 9, 2016 04:59
Laravel Uuid Model Trait
<?php
namespace App\Models\Traits;
use Ramsey\Uuid\Uuid;
use Illuminate\Database\Eloquent\Model;
trait UuidModel
{
/**
@scrubmx
scrubmx / HtmlProvider.php
Created August 2, 2016 20:02
Fzaninotto/Faker Html Provider
<?php
use Faker\Provider\Base as BaseProvider;
class HtmlProvider extends BaseProvider
{
/**
* @param int $nb
* @param bool $asText
* @return string
@scrubmx
scrubmx / AppServiceProvider.php
Created July 5, 2016 04:47
Register itsgoingd/clockwork only in local environment.
<?php
namespace App\Providers;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Support\ServiceProvider;
use Clockwork\Support\Laravel\ClockworkMiddleware;
use Clockwork\Support\Laravel\ClockworkServiceProvider;
class AppServiceProvider extends ServiceProvider
@scrubmx
scrubmx / s3
Created June 13, 2016 15:13 — forked from adamwiggins/s3
#!/usr/bin/env ruby
require 'aws/s3'
class S3Cmd
include AWS::S3
def initialize
Base.establish_connection!(
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],