Skip to content

Instantly share code, notes, and snippets.

View eisenjulian's full-sized avatar

Julian Eisenschlos eisenjulian

View GitHub Profile
public void testHello() {
say("clarin", "hola")
.assertButtonType(2, "empecemos", "ayuda")
.assertButtonTypeText("Soy el robot de")
.assertEnd()
say("clarin", "hola")
.assertButtonType(2, "ver men.", "ayuda")
.assertButtonTypeText("C.mo est.s", "Buenas tardes", "Buenas noches", "Buen.*d.a", "Hola")
final Optional<Pattern> customerNamePattern = filters.stream().filter(m -> "customerName".equals(m.get("t")))
.map(m -> m.get("_id_").toString().trim())
.findAny()
.map(pattern -> Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
final Optional<String> customerEmail = filters.stream().filter(m -> "customerEmail".equals(m.get("t")))
.map(m -> m.get("_id_").toString().trim())
.findAny();
final Predicate<Customer> customerFilter = c ->
private <T> Optional<T> redisApply(final BiFunction<Jedis, Boolean, T> callback) {
final List<T> result = new ArrayList<>();
new RetryingHandler().tryClosure((redisServer, results, loggingActivated, isProductionEnvironment) -> {
try (final Jedis jedis = redisServer.getPool().getResource()) {
result.add(callback.apply(jedis, isProductionEnvironment));
}
}, null);
return result.stream().findFirst();
}
# Bash script to make png images from svgs
mogrify -format png -size 400x400 -extent 764x400 -gravity center *.svg
public static void main(String[] args) {
Runner.run(context -> {
final String businessId = "holaSim";
final String pageId = "1793427134203438";
final String accessToken = "EAAZABjaJiSJsBANLRDF8czZCuyEAkFDY6JEZBeJGyhOb3wqDVuKOraCarUKsJijGwGcsABxTZBM1Q18NZC8K5rQbr4SxFRbhjOZBYs8MmbvHN9ZC46LZABf905LCEvzibzoQnkpwZAqYEBOrOgI1DD161LuIlyZB3WfmO4TBqriF2HaKKAxAhQ0H5vp45Q7lX7ZAONvU6ZCPiY0ZCOwZDZD";
final ChatChannelDAO chatChannelDAO = context.getDAO(ChatChannelDAO.class);
ChatChannel.buildAndSave(businessId, ChatPlatform.MESSENGER, true, pageId, accessToken, null);
final List<ChatChannel> channels = chatChannelDAO.findBy(businessId);
@eisenjulian
eisenjulian / quick-replies.sh
Last active June 12, 2017 20:02
Facebook Messenger Quick Replies template
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"USER_ID"
},
"message":{
"text":"Pick a color:",
"quick_replies":[
{
"content_type":"text",
"title":"Red",
{
"speech": "The next holiday is in 12 days.\nWhat do you want to do next?",
"contextOut": [
{
"name": "_actions_on_google_",
"lifespan": 100,
"parameters": {}
}
],
"data": {
{
"speech": "Sure!",
"contextOut": [
{
"name": "_actions_on_google_",
"lifespan": 100,
"parameters": {}
}
],
"data": {
{
"expectedInputs": [{
"possibleIntents": [{
"inputValueData": {
"listSelect": {"items": [
{
"optionInfo": {
"synonyms": [],
"key": "La sentida carta del hijo de Débora Pérez Volpin: \"Tranquila mami, estamos bien y te extrañamos muchísimo\""
},
vocab_size = 5000
sentence_size = 200
(x_train_variable, y_train), (x_test_variable, y_test) = imdb.load_data(num_words=vocab_size)
x_train = sequence.pad_sequences(
x_train_variable,
maxlen=sentence_size,
padding='post',
value=0)
x_test = sequence.pad_sequences(
x_test_variable,