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
rm routes/botman.php && wget https://raw.githubusercontent.com/botman/studio/master/routes/botman.php -P routes/ && rm app/Http/Controllers/BotManController.php && wget https://raw.githubusercontent.com/botman/studio/master/app/Http/Controllers/BotManController.php -P app/Http/Controllers/; rm app/Conversations/ExampleConversation.php; wget https://raw.githubusercontent.com/botman/studio/master/app/Conversations/ExampleConversation.php -P app/Conversations/ |
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
<scheme name="_@user_Atom One Dark" version="142" parent_scheme="Darcula"> | |
<option name="FONT_SCALE" value="1.0" /> | |
<metaInfo> | |
<property name="created">2018-03-23T15:28:07</property> | |
<property name="ide">PhpStorm</property> | |
<property name="ideVersion">2017.3.6.0.0</property> | |
<property name="modified">2018-03-23T15:34:31</property> | |
<property name="originalScheme">Atom One Dark</property> | |
</metaInfo> | |
<option name="LINE_SPACING" value="1.4" /> |
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 | |
function premiumUsers($users) | |
{ | |
$premiumUsers = []; | |
foreach ($users as $user) { | |
if ($user->type === USER_TYPE_PREMIUM) { | |
$premiumUsers[] = $user; | |
} | |
} |
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 | |
function premiumUsers($users) | |
{ | |
return array_filter($users, "userTypeIsPremium"); | |
} | |
function userTypeIsPremium($user) { | |
return $user->type = USER_TYPE_PREMIUM; | |
} |
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 | |
function premiumUsers($users) | |
{ | |
return array_filter($users, function ($user) { | |
return $user->type === USER_TYPE_PREMIUM; | |
}); | |
} |
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
class NullLogger implements Logger { | |
warn(message: string): void { | |
} | |
} | |
class LoggerFactory { | |
factory(env: string): Logger { | |
if (env === 'development') { | |
return new ConsoleLogger(); | |
} |
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
interface Logger { | |
warn(message: string): void; | |
} | |
class ConsoleLogger implements Logger { | |
warn(message: string): void { | |
console.warn(message); | |
} | |
} |
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
function log(target) { | |
console.log(target); | |
} | |
@log | |
class Foo {} | |
// [Function: Foo] |
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
function log(prefix) { | |
return target => { | |
console.log(`${prefix} - ${target}`); | |
} | |
} | |
@log('Awesome') | |
class Foo {} | |
// Awesome - function Foo() { |
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
function setApiVersion(constructor) { | |
constructor.api = '0.0.1'; | |
} | |
@setApiVersion | |
class Wizard {} | |
console.log(Wizard); // { [Function: Wizard] api: '0.0.1' } |