Skip to content

Instantly share code, notes, and snippets.

View fernyettheplant's full-sized avatar
Brewing Coffee

Fern fernyettheplant

Brewing Coffee
  • Montreal
View GitHub Profile
private static string imagenDefault = "/Content/imagenes/productos/default_box_art.jpg";
public static string ImageOrDefault(this HtmlHelper helper, string urlImagen)
{
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(urlImagen);
request.Method = "HEAD";
request.GetResponse();
return urlImagen;
@fernyettheplant
fernyettheplant / handler-first.js
Last active October 1, 2017 18:15
Example of a telegram bot responding anything using webtasks
'use strict';
module.exports = (context, cb) => {
const TelegramBot = require('node-telegram-bot-api');
const token = "YOUR_API_TOKEN";
const bot = new TelegramBot(token);
const chatId = context.body.message.chat.id;
const out = bot.sendMessage(chatId, 'Hello World!');
@fernyettheplant
fernyettheplant / handler.js
Last active October 1, 2017 18:29
Final Example of the bit tell in us a Dad Joke
'use strict';
module.exports = async (context, cb) => {
const TelegramBot = require('node-telegram-bot-api');
const axios = require('axios');
const token = "YOUR_API_KEY";
const bot = new TelegramBot(token);
const chatId = context.body.message.chat.id;

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@fernyettheplant
fernyettheplant / nuxt.config.js
Created April 14, 2018 21:23
Nuxt Config for Serverless Side Rendering
module.exports = {
head: {
title: 'Serverless Side Rendering',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project with Serverless' }
]
},
build: {
@fernyettheplant
fernyettheplant / serverless.yaml
Created April 14, 2018 21:32
Serverless Yaml for NuxtJS serverless side rendering
service: nuxt-serverless # NOTE: update this with your service name
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
functions:
nuxt:
'use strict';
const awsServerlessExpress = require('aws-serverless-express')
const app = require('./server')
const binaryMimeTypes = [
'application/javascript',
'application/json',
'application/octet-stream',
'application/xml',
'font/eot',
const express = require('express')
const {Nuxt} = require('nuxt')
const path = require('path')
const awsServerlessExpressMiddleware = require('aws-serverless-express/middleware')
// Create App
const app = express()
// Set API Gateway Middleware
app.use(awsServerlessExpressMiddleware.eventContext())
<template>
<div class="indexMargin">
<h1>This is the Front Page.</h1>
<h3>The chosen one is called {{ chosenOne }}</h3>
</div>
</template>
<script>
import axios from 'axios';
<template>
<nuxt/>
</template>
<script>
export default {
head: {
link: [
/* External css for article page */
{ rel: 'stylesheet', href: `https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css` }