Skip to content

Instantly share code, notes, and snippets.

View GAKINDUSTRIES's full-sized avatar
:bowtie:

Guillermo Kuster GAKINDUSTRIES

:bowtie:
View GitHub Profile
anon true, if the space may be omitted in anonymous function declarations
bitwise true, if bitwise operators should be allowed
browser true, if the standard browser globals should be predefined
cap true, if upper case HTML should be allowed
continue true, if the continuation statement should be tolerated
css true, if CSS workarounds should be tolerated
debug true, if debugger statements should be allowed
devel true, if logging should be allowed (console, alert, etc.)
eqeq true, if == should be allowed
es5 true, if ES5 syntax should be allowed
@GAKINDUSTRIES
GAKINDUSTRIES / Let's talk about JSONP.md
Last active March 6, 2018 05:00
Let's talk about JSONP.md

How do I first know JSONP

When I first start working with iframes that belongs to a third part application, it comes to my mind the possibility to manipulate them. My first stone in the road Same-origin-policy. If the iframe comes from a different domain, a browser's cross-domain policy would kick in, preventing the iframe from accessing cookies, local storage, or the DOM from its embedding document.

After getting deep into Same origin policy I found that this is not just an specific issue with iframes. The problem comes when you try to change the URL to point to a different domain such as http://domain.com/users/guille. The reason this fails is because there are security implications that come with making requests to different origins. I won’t bore you with specifics, but you can read more here.

The one item that bypasses this limitation is `

@GAKINDUSTRIES
GAKINDUSTRIES / Same origin policy.md
Last active March 6, 2018 05:01
Same origin policy, why is it so important?

Today is time to learn something about same-origin-policy and why it is so important to know when building a website. We will go through iframes too and what measures you have to take into account when using them. Hope you like it :D

What is it ?

The Same-Origin-Policy is an important concept in the web application security model. Under the policy, a web browser permits scripts contained in a first web page to access data in a second web page, but only if both web pages have the same origin. An origin is defined as a combination of URI scheme, hostname, and port number. This policy prevents a malicious script on one page from obtaining access to sensitive data on another web page through that page's Document Object Model.

This is the common definition that we will found on every page. But what really is it. Well, basically Same Origin Policy limits the access of one window to another.

The reason behind that is security. If you have https://GAKINDUSTRIES.com in one window and https://gmail

@GAKINDUSTRIES
GAKINDUSTRIES / New Javascript class syntax es2015.md
Last active March 6, 2018 04:58
New Javascript class syntax es2015

New Javascript class syntax ES2015

JavaScript classes introduced in ECMAScript 6 are syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax is not introducing a new object-oriented inheritance model to JavaScript. JavaScript classes provide a much simpler and clearer syntax to create objects and deal with inheritance.

Syntax

Defining a class

In ES5 and earlier, constructor functions defined “classes” like this:

@GAKINDUSTRIES
GAKINDUSTRIES / Understanding prototype and constructor and some subtleties in Javascript.md
Last active March 6, 2018 04:54
Understanding prototype and constructor and some subtleties in Javascript

Prototype and constructor.

The confusion arises when people talk about constructor and prototype simultaneously.

In the following example:

var employee = function Emp(name) {
    this.name = name;
}
@GAKINDUSTRIES
GAKINDUSTRIES / Use of 'prototype' vs. 'this' in JavaScript?.md
Last active March 6, 2018 05:02
Use of 'prototype' vs. 'this' in JavaScript?

Use of "prototype" vs "this" in Javascript

Take these 2 examples:

var A = function() { 
  this.hey = function() { alert('from A') } 
};

vs.

@GAKINDUSTRIES
GAKINDUSTRIES / Tmux shortcuts.md
Last active March 6, 2018 04:57
TMUX shortcuts

Cheatsheet for Tmux :D

Create a new session

  • tmux new -s [session-name]

Re attach to a session

  • tmux attach -t [session-name]

Split panes vertically

  • CapsLock - %