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
import { Pool } from 'pg' | |
import * as dotenv from 'dotenv' | |
import { colors } from 'colors' | |
dotenv.config() | |
export class DatabasePool { | |
constructor() { | |
if (!!DatabasePool.instance) { | |
return DatabasePool.instance; | |
} |
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
/* Database table install instructions */ | |
https://dev.mysql.com/doc/employee/en/employees-installation.html | |
/* Return employee record with max salary */ | |
SELECT * | |
FROM employee | |
WHERE salary = (SELECT MAX(salary) FROM employee) | |
/* Select highest salary in employee table */ | |
SELECT MAX(salary) |
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 FormData = require('form-data') | |
const request = require('request') | |
let form = new FormData() | |
let filename = `/myData/data.gz` | |
form.append('file', fs.createReadStream(filename)) | |
let options = { | |
url: `http://myServer/uploadFile`, | |
method: 'POST', | |
formData: { |
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 Writable = require('stream').Writable; | |
var util = require('util'); | |
var redis = require('./redis'); | |
var async = require('async'); | |
module.exports = RedisWriteStream; | |
function RedisWriteStream(client_id, broadcast_id, options) { | |
if (!(this instanceof RedisWriteStream)) return new RedisWriteStream(options); |
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
/* Initialize datatables */ | |
datatable = $('#dt_users').dataTable({ | |
// Tabletools options: | |
// https://datatables.net/extensions/tabletools/button_options | |
fixedHeader: true, | |
processing: true, | |
serverSide: true, | |
stateSave: true, | |
ajax: { | |
url : '/api/users', |
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
if ($_REQUEST['attempt'] >= 3 && empty($_GET['lp'])) { | |
// Check recaptcha | |
$secret = '6Lcb8yYUAAAAAI_TS_c88LNH4_gcud1Ay6ZdO71A'; | |
$code = $_REQUEST['g-recaptcha-response']; | |
$verify = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$code}"); | |
$response = json_decode($verify); | |
if ($response->success != true) { | |
$msg = '<div class="rows error">'; | |
$msg .= '<h3>Error</h3>'; | |
$msg .= '<p>Demasiados intentos fallidos, pruebe nuevamente</p>'; |