This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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?', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request->getCurlOptions()->add(CURLOPT_PROXY, 'tcp://192.168.56.1:8888'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ..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’]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyApp | |
{ | |
class Foo | |
{ | |
public function interactWithWordpress() | |
{ | |
return get_option('my_option_name'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($someArray as $value) { | |
if (isSomething($value)) { | |
$output->writeln("It's true!"); | |
} else { | |
$output->writeln("It's false!"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer