Skip to content

Instantly share code, notes, and snippets.

View yuriteixeira's full-sized avatar

Yuri Teixeira yuriteixeira

View GitHub Profile
@yuriteixeira
yuriteixeira / puppeteer_chromedevtools_android.md
Created August 28, 2018 08:41
Puppeteer/Chrome Dev Tools Protocol: How to manipulate Android Chrome or WebViews

First of all, get prepared by installing the Android SDK and SDK tools in order to get the adb executable. Then:

  1. adb connect <device ip>

  2. To get the service name `adb shell "cat /proc/net/unix | grep devtools_remote", which will give you something like this output:

00000000: 00000002 00000000 00010000 0001 01 423897 @webview_devtools_remote_18279
@yuriteixeira
yuriteixeira / xdebug_tests.md
Created October 14, 2015 10:30
Xdebug + Tests + IntelliJ
  • SSH to your machine like this: ssh -R 9000:localhost:9000 your.remote.machine
  • Ensure you have Xdebug installed and configured with xdebug.remote_enable=1
  • Add this snippet to your .bash_profile or similar shell init script:
# XDebug  
function xdebug-start {
	xdebug_site=$1
	xdebug_host=$2
	xdebug_port=$3
@yuriteixeira
yuriteixeira / skyscanner.php
Last active August 29, 2015 14:21
Generate skyscanner search urls. To open then, copy and paste the result on openlist chrome extension (https://chrome.google.com/webstore/detail/openlist/nkpjembldfckmdchbdiclhfedcngbgnl?hl=en), like you see here: http://i.imgur.com/oCfY2Wy.jpg
<?php
// Usage :
// php fly.php <start_date> <trip_interval> <variance> <from> <to>
//
// Eg: A 7 day trip from VIX to STOC, 30 days of variance
// php fly.php 2015-07-01 30 "+7 day" vix stoc
$start = new \DateTime("{$argv[1]}");
$variance = "+{$argv[2]} day";
@yuriteixeira
yuriteixeira / tdd.sh
Created March 20, 2015 17:30
TDD Made Easy - Run tests when the files change
# TDD
function tdd {
pathToTestRunner=$1
filesToWatch=$2
if [[ -z $pathToTestRunner ]]
then
pathToTestRunner="vendor/bin/phpunit"
fi
@yuriteixeira
yuriteixeira / go-oop-inherit.go
Last active August 29, 2015 14:17
OOP and Golang: "Inheritance"
package main
import "fmt"
type Foo struct {
what string
howMany int
}
type Bar struct {
@yuriteixeira
yuriteixeira / boot2docker-vbox-foldershare-mac.sh
Last active August 29, 2015 14:07
Boot2Docker + Virtual Box Additions (will make volume share work with Mac OS X)
#!/bin/bash
boot2docker down
wget http://static.dockerfiles.io/boot2docker-v1.2.0-virtualbox-guest-additions-v4.3.14.iso
mv ~/.boot2docker/boot2docker.iso ~/.boot2docker/boot2docker.iso.backup
cp boot2docker-v1.2.0-virtualbox-guest-additions-v4.3.14.iso ~/.boot2docker/boot2docker.iso
@yuriteixeira
yuriteixeira / filebot-amc.sh
Last active December 17, 2015 11:49
Filebot AMC (Automated Media Center) Helper
#!/bin/bash
if [ $1 ] && [ $1 == '-h' ]
then
echo ""
echo "Welcome to Filebot AMC (Automated Media Center) Script."
echo ""
echo "Usage: filebot-amc.sh [torrent_name] [/path/to/torrent] [/path/to/media] [/path/to/log]"
echo ""
echo "NOTES: "
@yuriteixeira
yuriteixeira / gist:5191784
Created March 18, 2013 23:09
fix problem on doctrine odm
protected function loadConnections(array $connections, ContainerBuilder $container)
{
$cons = array();
foreach ($connections as $name => $connection) {
// Define an event manager for this connection
$eventManagerId = sprintf('doctrine_mongodb.odm.%s_connection.event_manager', $name);
$container->setDefinition($eventManagerId, new DefinitionDecorator('doctrine_mongodb.odm.connection.event_manager'));
$configServiceName = sprintf('doctrine_mongodb.odm.%s_configuration', $name);
@yuriteixeira
yuriteixeira / BehatTest.php
Created December 16, 2012 20:16 — forked from jakzal/BehatTest.php
A quick and dirty PHPUnit test case that runs behat, making code coverage reports being possible!
<?php
use Symfony\Component\Console\Input\ArrayInput;
use Behat\Behat\Console\BehatApplication;
use Symfony\Component\Console\Output\ConsoleOutput;
class BehatTest extends \PHPUnit_Framework_TestCase
{
public function testThatBehatScenariosMeetAcceptanceCriteria()
{
1) Criar uma entidade chamada StaticFile, com os atributos:
- original_name
- content_type
- slug
- size
2) Alterar a entidade CmsBlock, adicionando o atributo:
- is_published
3) Criar um novo botão no editor TinyMCE, que chamará um popup de upload de imagens