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
import tensorflow as tf | |
import numpy as np | |
# List out our bandits. Currently bandit 4 (index#3) is set to most often provide a positive reward. | |
# Reward of 1 if given if the random number 0-1 is lower than the bandit value | |
bandits = [0.5, 0.1, 0.3, 0.8] | |
num_bandits = len(bandits) | |
def pullBandit(bandit): |
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
// Call | |
loadAdformAd(container, adformId, name, extraParams, () => { | |
clearTimeout(this.timer); | |
this.timer = setTimeout(() => { | |
this.onViewable(); | |
}, 1000); | |
}); | |
this.timer = setTimeout(() => { this.onViewable(); }, 8000); | |
// Function |
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
# app/config/config.yml | |
services: | |
monolog.formatter.request: | |
class: Monolog\Formatter\LineFormatter | |
arguments: | |
- "[%%datetime%%] [%%extra.username%%] %%channel%%.%%level_name%%: %%message%% %%context%% [%%extra.postParams%%]\n" | |
# app/config/config_prod.yml | |
monolog: | |
handlers: |
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 AppBundle\Monolog; | |
use JMS\DiExtraBundle\Annotation as DI; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; | |
use Symfony\Component\Security\Core\User\UserInterface; | |
/** |
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 AppBundle\Cache; | |
use JMS\DiExtraBundle\Annotation as DI; | |
use Symfony\Component\HttpFoundation\RequestStack; | |
use Doctrine\Common\Cache\CacheProvider; | |
use AppBundle\Model\SomethingGeneratorInterface; | |
/** |
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
import React, { Component } from 'react'; | |
export default class MyTextEditor extends Component { | |
componentDidMount() { | |
import('jquery').then((jquery) => { | |
window.jQuery = jquery; | |
window.$ = jquery; | |
import('../lib/redactor/redactor.js').then(() => { | |
$(this.refs.textarea).redactor(); | |
}); |
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
import React, { Component } from 'react'; | |
export default class MyTextEditor extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
redactorLoaded: 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
(function() { | |
var errorBoxElement = false; | |
var showError = function(error) { | |
if (!errorBoxElement) { | |
errorBoxElement = document.createElement('div'); | |
errorBoxElement.style.position = 'absolute'; | |
errorBoxElement.style.top = '0'; | |
errorBoxElement.style.bottom = '0'; | |
errorBoxElement.style.left = '0'; | |
errorBoxElement.style.right = '0'; |
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
cd {{project}} | |
# Remove dots from branch name (one may want to do more cleaning here) | |
branch=$(echo "{{branch}}"|sed "s/\.//g") | |
if [ "$branch" != "master" ]; then | |
# Replace the current symlink with the one we saved before | |
mv -T current_archived current | |
# Make sure the branches directory exists |
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
cd {{project}} | |
# Remove dots from branch name (one may want to do more cleaning here) | |
branch=$(echo "{{branch}}"|sed "s/\.//g") | |
if [ "$branch" != "master" ]; then | |
# Cleanup symlinks that may be left over from previous deploy | |
rm -f current_archived | |
# Save the current symlink so we can restore it later |
NewerOlder