This file contains 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
var obj = require('./sample_module.js'); | |
/*Invoke CallFun function Of main.js*/ | |
obj.Method1(); | |
console.log("Hello! Nodejs"); | |
// Output: | |
// Invoke call Function | |
// Hello! Nodejs |
This file contains 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
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) { |
This file contains 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
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 = |
This file contains 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
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); |
This file contains 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
const a = { | |
i: 1, | |
toString: function () { | |
return a.i++; | |
} | |
} | |
console.log(a == 1 && a == 2 && a == 3) // true |
This file contains 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 | |
$apiContext = new ApiContext( | |
new OAuthTokenCredential( | |
env('PAYPAL_CLIENT_ID'), // ClientID | |
env('PAYPAL_CLIENT_SECRET') // ClientSecret | |
) | |
); | |
/*$apiContext->setConfig( | |
array( |
This file contains 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
npm init -y | |
npm install -S discord.js |
This file contains 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
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!'); |
This file contains 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
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$ { |
This file contains 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
Show hidden characters
{ | |
"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. */ |