Skip to content

Instantly share code, notes, and snippets.

View rtuin's full-sized avatar
😃
Hi!

Richard Tuin rtuin

😃
Hi!
View GitHub Profile
@rtuin
rtuin / commitmessagegenerator.php
Created August 29, 2014 07:03
A random commit message generator
<?php
$messages = [
'I think everyone who says they don\'t like watching themselves in movies should stop lying.',
'I was a square for so long and it totally amazes me that people think I am cool.',
'Nein. Nein. Nein. Nein.',
'A movie is just a movie to me. They open, they close.',
'What kills me is that everybody thinks I like jazz.',
'Definitely. And I always do - I love me on-screen!',
'Why do we fall, Master Bruce?',
@rtuin
rtuin / guzzleproxy.php
Last active August 29, 2015 14:07
Make guzzle use a proxy using the curl options
<?php
$request->getCurlOptions()->add(CURLOPT_PROXY, 'tcp://192.168.56.1:8888');
@rtuin
rtuin / Configuration.php
Created April 9, 2015 15:38
symfony2 dynamic config blogpost config.yml
// ..Bundle/DependencyInjectionConfiguration::getConfigTreeBuilder
$rootNode
->validate()
->ifTrue(function($config) {
return is_array($config) &&
array_key_exists('default_bus', $config) &&
array_key_exists('commandbus', $config);
})
->then(function($config) {
$busNames = array_keys($config[‘commandbus’]);
@rtuin
rtuin / Foo.php
Created July 19, 2015 14:03
Simplified PHPSpec + Wordpress approach
<?php
namespace MyApp
{
class Foo
{
public function interactWithWordpress()
{
return get_option('my_option_name');
}
<div class=”article”>
<div class=”header”>Very interesting article</div>
<div class=”introduction”>
This is a very interesting article. However, the content is all wrapped in div tags!
</div>
<div class=”content”>
Now this can be a very interesting story to read, but a computer can’t value it’s content against other random texts on this page.
</div>
</div>
export QUERY_STRING="start_debug=1&debug_stop=1&debug_fastfile=1&debug_coverage=1&use_remote=1&send_sess_end=1&debug_session_id=2000&debug_start_session=1&debug_port=10137&debug_host=192.168.0.254"
@rtuin
rtuin / .bashrc
Last active December 11, 2015 14:38
function mybugon() {
export QUERY_STRING="start_debug=1&debug_stop=1&debug_fastfile=1&debug_coverage=1&use_remote=1&send_sess_end=1&debug_session_id=2000&debug_start_session=1&debug_port=10137&debug_host=192.168.56.1"
export PHP_IDE_CONFIG="serverName=$1"
}
alias bugon="mybugon"
alias bugoff="unset QUERY_STRING"
<?php
class Bundles implements ResponseClassInterface
{
protected $bundles = array();
public function addBundle($bundle)
{
$this->bundles[] = $bundle;
}
before "deploy:finalize_update", "deploy:minify_javascript"
namespace :deploy do
task :minify_javascript do
run_locally "cd #{copy_cache} && java -jar yuicompressor-2.4.7.jar -o public/js/script.min.js public/js/script.unpacked.js"
top.upload(File.join("#{copy_cache}", "/public/js/script.min.js"), "#{release_path}/public/js/script.min.js")
end
end
build/*.xml