Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| use Symfony\Component\HttpFoundation\File\File; | |
| use Symfony\Component\HttpFoundation\File\UploadedFile; | |
| /** | |
| * @Entity | |
| */ | |
| class Document | |
| { |
| cd ~ | |
| # Install the required JDK | |
| sudo apt-get install openjdk-6-jre-headless | |
| # Download, extract and move ElasticSearch | |
| wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.6.tar.gz -O elasticsearch.tar.gz | |
| tar -xf elasticsearch.tar.gz | |
| rm elasticsearch.tar.gz | |
| sudo mv elasticsearch-* elasticsearch |
| <?php | |
| use Symfony\Component\Translation\TranslatorInterface; | |
| function format(\DateTime $date, TranslatorInterface $translator) | |
| { | |
| $diff = date_create()->diff($date); | |
| $seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s; | |
| $format = $translator->transChoice('reldate', $seconds); |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| ;; based on core.logic 0.8-alpha2 or core.logic master branch | |
| (ns sudoku | |
| (:refer-clojure :exclude [==]) | |
| (:use clojure.core.logic)) | |
| (defn get-square [rows x y] | |
| (for [x (range x (+ x 3)) | |
| y (range y (+ y 3))] | |
| (get-in rows [x y]))) |
This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.
I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.
def local_cache(box_name)
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
'cache',
'apt',
box_name)| <?php | |
| define('T', ' '); | |
| define('N', PHP_EOL); | |
| $functions = array(); | |
| $classes = array(); | |
| $constant_prefix = 'X_'; | |
| $php = '<?php' . N; |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project name="Project-name-here" default="build" basedir="."> | |
| <target name="lock_check" description="Checks for vulnerabilities through a SensioLabs web service" | |
| depends="lock_reset,lock_get,lock_show"> | |
| <local name="vulnerabilities.clean"/> | |
| <loadfile property="vulnerabilities.clean" | |
| srcfile="${basedir}/build/logs/check_lock.log"> | |
| <filterchain> |
If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0
phantomjs:
extensions:
Behat\MinkExtension\Extension:
base_url: http://dev.local
goutte: ~
selenium2:
wd_host: "http://localhost:8643/wd/hub"
| docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi |