Skip to content

Instantly share code, notes, and snippets.

View saineshmamgain's full-sized avatar
🎯
Focusing

Sainesh Mamgain saineshmamgain

🎯
Focusing
View GitHub Profile
@saineshmamgain
saineshmamgain / app.js
Created May 5, 2020 04:06
Setting up laravel-websockets on production server using nginx proxy with letsencrypt ssl
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
wsHost: window.location.host,
wsPort: 80,
wssPort: 443,
disableStats: true,
enabledTransports: ['ws', 'wss'],
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
});
@saineshmamgain
saineshmamgain / exportcsv.js
Created August 2, 2017 07:25
get CSV from HTML in javascript
function exportTableToCSV($table, filename) {
var $headers = $table.find('tr:has(th)')
,$rows = $table.find('tr:has(td)')
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
,tmpColDelim = String.fromCharCode(11) // vertical tab character
,tmpRowDelim = String.fromCharCode(0) // null character
// actual delimiter characters for CSV format
@saineshmamgain
saineshmamgain / Code to Copy html in javascript
Last active May 25, 2018 05:25
copy html contents to clipboard using javascript
<!DOCTYPE html>
<!--
Created using multiple answers from StackOverFlow. Will only support modern browsers.
StackOverFlow answers:
http://stackoverflow.com/a/30566157/4485147
http://stackoverflow.com/a/2044793/4485147
-->