Skip to content

Instantly share code, notes, and snippets.

View lorenzo's full-sized avatar

José Lorenzo Rodríguez lorenzo

View GitHub Profile
@lorenzo
lorenzo / Counter.elm
Last active September 21, 2016 15:07 — forked from hipertracker/Counter.elm
Elm example
module Main exposing (..)
{- This file re-implements the Elm Counter example (1 counter) with elm-mdl
buttons. Use this as a starting point for using elm-mdl components in your own
app.
-}
import Html.App as App
import Html exposing (..)
import Html.Attributes exposing (href, class, style)
@lorenzo
lorenzo / gen_docs.php
Last active September 19, 2016 11:37
<?php
//call `php gen_docs.php` in the forlder where docs.json is
// The markdown will be spit out to stdout
$sections = json_decode(file_get_contents("docs.json"), true);
$output = "";
function replaceDocs($comment, $section) {
return preg_replace_callback('/@docs\s+(.+)/mu', function ($matches) use ($section) {
<?php
$sections = json_decode(file_get_contents("docs.json"), true);
$output = "";
function replaceDocs($comment, $section) {
return preg_replace_callback('/@docs\s+(.+)/mu', function ($matches) use ($section) {
$tokens = array_map('trim', explode(',', $matches[1]));
actions : List Step
actions =
[ visit "https://google.com"
, title <| Expect.equal "this will fail!"
, elementCount "input" <| Expect.atLeast 1
, setValue "input[name='q']" "Elm lang"
, elementText "#rso > div:nth-child(1) > div:nth-child(1) > div > h3 > a" <| Expect.equal "Elm is the best"
, click "#rso > div:nth-child(1) > div:nth-child(1) > div > h3 > a"
, pause 2000
, title <| Expect.equal "home"
<?php
if (!empty($this->request->data('applications.companies_ids'))) {
// Recupero gli ids delle aziende a cui l'agente si è candidato
$companiesIds = array_diff(
$this->request->data('applications.companies_ids'),
(new Collection($agent->applications))->extract('company_id')->toArray()
);
var webdriverio = require('webdriverio');
var elm = require('./main.js');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
var sessions = new WeakMap;
<?php
$q->where(function ($exp, $q) use ($userVal) {
return $exp->gte($q->newExpr('foo * bar'), $userVal, 'integer');
})
<?php
namespace App\Controller\Component;
use Cake\Controller\Component\PaginatorComponent;
use Cake\Datasource\RepositoryInterface;
use Cake\Network\Exception\NotFoundException;
use Cake\ElasticSearch\Query;
class ElasticPaginatorComponent extends PaginatorComponent
<?php
namespace App\Routing\Filter;
use Cake\Event\Event;
use Cake\Routing\Dispatcherfilter;
class TrustProxyFilter extends DispatcherFilter
{
/**
* {inheritDoc}
<?php
namespace App\Routing\Filter;
use Cake\Event\Event;
use Cake\Routing\DispatcherFilter;
class JsonInputFilter extends DispatcherFilter
{
public function beforeDispatch(Event $e)