Skip to content

Instantly share code, notes, and snippets.

View w3debugger's full-sized avatar
🎯
Focusing

Muhammad Umar w3debugger

🎯
Focusing
View GitHub Profile
@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);
};
@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>
@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;
}
@nicbell
nicbell / 1_primitive_comparison.js
Last active September 23, 2022 16:56
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
@philippebarbosa
philippebarbosa / unlike-facebook-page-fast.md
Last active August 24, 2022 01:40
A simple way to unlike all facebook page in one time !

How to unlike all Facebook page at once

If you want to do cleaning on your Facebook timeline, you may want to unlike all Facebook pages quickly. There is a way for that :

  • Go to firefox and install iMacros
  • Open a text editor (i.e. Notepad, Sublime Text), and paste that code inside :
VERSION BUILD=7401110 RECORDER=FX
@nmsdvid
nmsdvid / new_gist_file.js
Created February 4, 2014 16:32
Simple JavaScript Debounce Function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
%reset-Button {
border: none;
margin: 0;
padding: 0;
width: auto;
overflow: visible;
background: transparent;
/* inherit font & color from ancestor */
@mds
mds / dropbox-redirect.html
Created March 5, 2015 16:42
A Simple JS Redirect
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- Replace with your own title -->
<title>Your Project's Title</title>
<script>
// Add your own shareable dropbox link
window.location.replace("https://www.dropbox.com");
</script>
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@milosdjakonovic
milosdjakonovic / pattern.js
Created July 28, 2016 18:50
Regex to match media queries and get values
/@\s*?media\s*?\(\s*?(min|max)-(width|height)\s*?:\s*?(\d+)(px|em)\s*?\)\s*?{(.*)}/gms
/**
* Only basically tested.
* Should match min-max-width-height number px|em and following rules.
* Provides capturing groups to determinate condition alongside with css.
*
* Created with help of regex101
* https://regex101.com/r/zA6fX2/1