List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) { | |
this.allowedOrigins = allowedOrigins; | |
let childWindow; | |
// some browser (don't remember which one) throw exception when you try to access | |
// contentWindow for the first time, it works when you do that second time | |
try { | |
childWindow = iframe.contentWindow; | |
} catch(e) { | |
childWindow = iframe.contentWindow; |
(function($) { | |
$(document).ready(function($) { | |
//hash link click | |
$('a[href*="#"]').on('click', function(e) { | |
e.preventDefault(); | |
//console.log('hash clicked'); //uncomment this link to understand if click is working |
Route::get('artisan/command/{key?}', array(function($key = null) | |
{ | |
Artisan::call('config:clear'); | |
if($key == "cache-clear") | |
{ | |
try | |
{ | |
echo '<br>php artisan cache:clear...'; | |
Artisan::call('cache:clear'); |
describe("Alert component", function() { | |
var c = require('./../../../resources/assets/js/components/Alert.vue'); | |
it('should have data', function () { | |
expect(typeof c.data).toBe('function'); | |
}); | |
it('should be visible', function () { | |
var defaultData = c.data(); |
// set-up a connection between the client and the server | |
var socket = io.connect(); | |
// let's assume that the client page, once rendered, knows what room it wants to join | |
var room = "abc123"; | |
socket.on('connect', function() { | |
// Connected, let's sign-up for to receive messages for this room | |
socket.emit('room', room); | |
}); |