Skip to content

Instantly share code, notes, and snippets.

😃
Hi!

Richard Tuin rtuin

😃
Hi!
Block or report user

Report or block rtuin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am rtuin on github.
  • I am rtuin (https://keybase.io/rtuin) on keybase.
  • I have a public key ASA4tEyxdNOO-yCgRjaKEUGEBS8XRb1xo5eaMr5b6gaiAAo

To claim this, I am signing this object:

View config.yml
snc_redis:
clients:
doctrine_meta:
type: phpredis
alias: doctrine_meta
dsn: redis://localhost/2
doctrine:
metadata_cache:
client: doctrine_meta
entity_manager: default # the name of your entity_manager connection
View codesniffers-right.php
<?php
foreach ($someArray as $value) {
if (isSomething($value)) {
$output->writeln("It's true!");
} else {
$output->writeln("It's false!");
}
}
View generators.php
<?php
// Example: Iterate over all resources from a paginated API endpoint
// PHP 5 vs PHP 7
// Both examples iterate over records like this:
foreach (findAll() as $row) {
// Handle $row
}
@rtuin
rtuin / gist:879b7efed082cc9e178c
Created Aug 24, 2015
WeCamp 2015 packing list
View gist:879b7efed082cc9e178c
❏ Swim shorts
❏ Slippers
❏ 2 pair of shoes
❏ 4 trousers
❏ 3/4 shorts
❏ sweatpants
❏ 3/4 sweatshirts
❏ 5/6 t-shirts
❏ 8 pair of socks
❏ 8 boxershorts
@rtuin
rtuin / Foo.php
Created Jul 19, 2015
Simplified PHPSpec + Wordpress approach
View Foo.php
<?php
namespace MyApp
{
class Foo
{
public function interactWithWordpress()
{
return get_option('my_option_name');
}
@rtuin
rtuin / Configuration.php
Created Apr 9, 2015
symfony2 dynamic config blogpost config.yml
View Configuration.php
// ..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 / guzzleproxy.php
Last active Aug 29, 2015
Make guzzle use a proxy using the curl options
View guzzleproxy.php
<?php
$request->getCurlOptions()->add(CURLOPT_PROXY, 'tcp://192.168.56.1:8888');
@rtuin
rtuin / commitmessagegenerator.php
Created Aug 29, 2014
A random commit message generator
View commitmessagegenerator.php
<?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 / detect-if-emulator.js
Last active Jul 15, 2018
Titanium: Detect whether you're running in an emulator or not.
View detect-if-emulator.js
// Detect whether we're running inside a simulator or not.
// Put this in your app.js or alloy.js
function isEmulator() {
return (Ti.Platform.manufacturer == 'Genymotion' || Ti.Platform.model == 'Simulator');
}
// Use it to create mocks, for example:
function Foo() {
this.init();
You can’t perform that action at this time.