Skip to content

Instantly share code, notes, and snippets.

View LouCypher's full-sized avatar
💸
Flat broke. Needs money.

Zulkarnain K. LouCypher

💸
Flat broke. Needs money.
View GitHub Profile
@old-repo-ekoteguh
old-repo-ekoteguh / webdev_online_resources.md
Created July 17, 2018 02:24 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@unnikked
unnikked / README.md
Last active February 19, 2024 02:58
How to host your Telegram bot on Google App Script

Telegram Bot on Google App Script

This is the source code of one of my blog post. To read the full blog post please click here.

@pmclanahan
pmclanahan / contribute.json
Last active November 25, 2023 02:33
Proposal Schema for contribute.json
{
// required
"name": "Name of the project. (e.g. Bedrock)",
"description": "Awesome website of sweetness",
"repository": {
"type": "git",
"url": "https://github.com/mozilla/bedrock"
},
// optional
@Noitidart
Noitidart / about.md
Last active April 13, 2022 17:52 — forked from antichris/about.md
Adds a fully functional "Fork" button to your own Gist.

Fork your own Gist

This is a script that adds a fully functional Fork button to your own Gist.

If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.

The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well). Meaning you will have to run the script every new page load.

Firefox

Copy the contents from bookmarklet.js, open Scracthpad (Ctrl+F4), paste it there. Back in browser, swwitch to tab with your Gist you want to fork. Back in Scratchpad, "Run" it. Save and/or bookmark the Scratchpad file for future use.

@Noitidart
Noitidart / _template-listenPageLoad-insertElements.xpi
Last active January 4, 2016 20:19
Demo on how to create ff-addon that listens to page loads and inserts a DIV element into it. This example inserts a blue div 200x200 pixels at top left if mozillazine is found in the address. This demo uses the nsIWindowMediatorListener and nsIWindowMediator method.
@Infocatcher
Infocatcher / cb_repair_broken_overlay.js
Created December 20, 2012 08:16
Repair Custom Buttons after save in Nightly with javascript.options.xml.chrome = false http://custombuttons.sf.net/forum/viewtopic.php?p=2905#p2905
// http://custombuttons.sf.net/forum/viewtopic.php?p=2905#p2905
// (c) Infocatcher 2012
// version 0.1.0 - 2012-12-20
// Repair Custom Buttons after save in Nightly with javascript.options.xml.chrome = false
// Use at your own risk!
// Backup your %profile%/custombuttons directory first!
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
anonymous
anonymous / gist:4285679
Created December 14, 2012 14:05
Adding a Toolbar Button in a Bootstrapped Firefox Extension
function addButton(toolbarId, buttonId, label, iconPath, firstRun) {
var toolbar = document.getElementById(toolbarId);
var toolbarButton = document.createElement("toolbarbutton");
toolbarButton.setAttribute("id", buttonId);
toolbarButton.setAttribute("type", "button");
toolbarButton.setAttribute("removable", "true");
toolbarButton.setAttribute("class",
"toolbarbutton-1 chromeclass-toolbar-additional");
toolbarButton.setAttribute("label", label);
toolbarButton.style.listStyleImage = "url(" + iconPath + ")";
@cjohansen
cjohansen / gist:4135065
Created November 23, 2012 10:43
Naming this in nested functions

tl;dr

If you must nest functions in a way that requires access to multiple this', alias outer this to something meaningful - describe the value it's holding. Treat this as the invisible first argument.

In general though, avoiding the situation (nested functions and frivolous use of this) will frequently produce clearer results.

Naming this in nested functions

I was accidentally included in a discussion on how to best name this in nested functions in JavaScript. +1's were given to this suggestion of using _this.

Giving style advice on naming nested this without a meaningful context isn't too helpful in my opinion. Examples below have been altered to have at least some context, although a completely contrived and stupid one.

@johan
johan / document.doctype.toString.coffee
Created October 30, 2012 00:36
A more useful DocumentType.prototype.toString implementation than present-day browsers provide.
# With thanks to Stewart Brodie for the reminder: http://goo.gl/IHa4p
# (See old version of this gist for a more roundabout hack I came up with)
window.DocumentType::toString = -> (new XMLSerializer).serializeToString @
@tacomanator
tacomanator / gist:3127271
Created July 17, 2012 05:00
Firefox 3D view helps spot application vulnerabilities

Firefox 3D view helps spot application vulnerabilities

A colleague and I were checking out the 3D view now built into Firefox. What a nifty way to visualize the page structure! Well, it turns out it also helped us discover a vulnerability in our web app. In particular, a bit of untrusted user input that we forgot to encode before outputting. Read on to find out how.

Why this is important

Care must be taken to encode all untrusted input before displaying it back to the user. Attackers can take advantage of unencoded output to embed malicious tags and run arbitrary scripts on another users' computer. While this is less of a risk when data is not shared among multiple users, one should still carefully encode output.

How 3D view helps