Skip to content

Instantly share code, notes, and snippets.

View kiramishima's full-sized avatar
🕹️
https://www.twitch.tv/kiramishima

Paul Arizpe kiramishima

🕹️
https://www.twitch.tv/kiramishima
View GitHub Profile
@kiramishima
kiramishima / app.js
Created September 16, 2017 22:03
Ejemplo uso de modulo javascript (usaremos sample_module.js)
var obj = require('./sample_module.js');
/*Invoke CallFun function Of main.js*/
obj.Method1();
console.log("Hello! Nodejs");
// Output:
// Invoke call Function
// Hello! Nodejs
@kiramishima
kiramishima / app.js
Created September 17, 2017 23:06
Sample Bot Reservation
var bot = new builder.UniversalBot(connector, [
function (session) {
session.send("Welcome to the dinner reservation.");
builder.Prompts.time(session, "Please provide a reservation date and time (e.g.: June 6th at 5pm)");
},
function (session, results) {
session.dialogData.reservationDate = builder.EntityRecognizer.resolveTime([results.response]);
builder.Prompts.number(session, "How many people are in your party?");
},
function (session, results) {
@kiramishima
kiramishima / main.fs
Created December 6, 2017 00:35
F# => Function to receive to two integers number from the user and then print the bigger
open System
let whatisbigger (x:int) (y:int): string =
if x = y then "x is equal to y"
else if x > y then "x isNull bigger than y"
else if x < y then "y is bigger than x"
else "it no supported"
[<EntryPoint>]
let main argv =
@kiramishima
kiramishima / sample route
Created December 26, 2017 23:50
Sending Files with Koa
myRoute.get("/download", async function (ctx) {
try {
const stream = fs.createReadStream(path.resolve(__dirname, '../public/img/350x150.png'));
// ctx.type = 'image/png';
// with attachment
// ctx.attachment(path.resolve( __dirname, '350x150.png'));
ctx.set('Content-disposition', 'attachment; filename= file.png');
ctx.body = stream;
} catch (ex) {
log.error(ex);
@kiramishima
kiramishima / el_valor_de_a.js
Last active February 8, 2018 18:01
Ejercicio propuesto en Eventloop (uff casi escribí chelajs XD)
const a = {
i: 1,
toString: function () {
return a.i++;
}
}
console.log(a == 1 && a == 2 && a == 3) // true
@kiramishima
kiramishima / sample_payout_paypal.php
Last active March 21, 2018 00:09
Paypal Payout PHP (Only for USA )
<?php
$apiContext = new ApiContext(
new OAuthTokenCredential(
env('PAYPAL_CLIENT_ID'), // ClientID
env('PAYPAL_CLIENT_SECRET') // ClientSecret
)
);
/*$apiContext->setConfig(
array(
@kiramishima
kiramishima / Shell
Created May 6, 2018 20:33
Creando Bots para Discord
npm init -y
npm install -S discord.js
@kiramishima
kiramishima / index.js
Created May 6, 2018 20:38
Creando Bots para Discord
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('Pong!');
@kiramishima
kiramishima / default.conf
Last active August 29, 2018 00:31
Ejemplo de Docker con PHP y Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /home/sample.com/apps/code/public;
location ~ \.php$ {
@kiramishima
kiramishima / tsconfig.json
Created November 21, 2018 00:12
Archivo default generado al inicializar un proyecto typescript
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */