Skip to content

Instantly share code, notes, and snippets.

Avatar

Yuri Teixeira yuriteixeira

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

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 Oct 14, 2015
Xdebug + Tests + IntelliJ
View xdebug_tests.md
  • 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 Aug 29, 2015
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
View skyscanner.php
<?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 Mar 20, 2015
TDD Made Easy - Run tests when the files change
View tdd.sh
# TDD
function tdd {
pathToTestRunner=$1
filesToWatch=$2
if [[ -z $pathToTestRunner ]]
then
pathToTestRunner="vendor/bin/phpunit"
fi
@yuriteixeira
yuriteixeira / go-oop-inherit.go
Last active Aug 29, 2015
OOP and Golang: "Inheritance"
View go-oop-inherit.go
package main
import "fmt"
type Foo struct {
what string
howMany int
}
type Bar struct {
@yuriteixeira
yuriteixeira / boot2docker-vbox-foldershare-mac.sh
Last active Aug 29, 2015
Boot2Docker + Virtual Box Additions (will make volume share work with Mac OS X)
View boot2docker-vbox-foldershare-mac.sh
#!/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 Dec 17, 2015
Filebot AMC (Automated Media Center) Helper
View filebot-amc.sh
#!/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 Mar 18, 2013
fix problem on doctrine odm
View gist:5191784
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 Dec 16, 2012 — forked from jakzal/BehatTest.php
A quick and dirty PHPUnit test case that runs behat, making code coverage reports being possible!
View BehatTest.php
<?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()
{
View gist:1829820
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
You can’t perform that action at this time.