Skip to content

Instantly share code, notes, and snippets.

View w3debugger's full-sized avatar
🎯
Focusing

Muhammad Umar w3debugger

🎯
Focusing
View GitHub Profile
@nicbell
nicbell / 1_primitive_comparison.js
Last active December 10, 2024 13:04
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true
@pgainda
pgainda / public_property_problem
Created May 28, 2013 18:19
Now, let's say you're an attacker that really doesn't like Jones. You want to change the amount of money in Jones' bank account from $1,000,000 to $5.
function BankAccount( lastname ) {
this.lastname = lastname;
this.balance = 1000000;
}
// write your function here
function attackBalance(account){
account.balance = 5;
}
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@jrmoran
jrmoran / loader.js
Created January 14, 2012 04:55
dynamic script loader
var myLoader = function(filename, fun) {
var head = document.getElementsByTagName('head')[0],
script = document.createElement('script');
script.type = 'text/javascript';
script.src = filename;
if(typeof fun === 'function'){ script.onload = fun; }
head.appendChild(script);
};