This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (sure, just for debugging!) | |
var target = {}; | |
target.__exposedProps__ = new Proxy(Object.freeze({}), | |
new Proxy({ | |
get: function() | |
{ | |
return "rw"; | |
}, | |
getOwnPropertyDescriptor: function() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Failing test case: | |
1. Open this page: https://getfirebug.com/tests/head/script/4213/issue4213.html | |
2. With the DevTools, set a breakpoint at line 4 of issue4213-1.js (in myFunc1) | |
3. Click on the "Execute Test" button of the webpage | |
|=> the breakpoint is hit | |
4. Step over | |
|=> the return value is displayed | |
5. Run this in Scratchpad (environment = browser) | |
6. Resume the execution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
"use strict"; | |
console.log(this); | |
</script> | |
</head> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Instructions : | |
* 1) Go to https://getfirebug.com/testresults, select the "Users" tab | |
* 2) Expand two groups of your choice | |
* 3) Run the snippet below in the Console of your choice, as long as it is Firebug :) | |
* | |
* License: WTFPL (https://fr.wikipedia.org/wiki/WTF_Public_License) | |
*/ | |
var groups = $$(".groupBodyRow"); | |
if (groups.length !== 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AMD's define function using ES6 default parameter and require. | |
* | |
* With some tweaks of AMD and using an ES6 Browser, this idioms intends to improve readability | |
* and maintainability of modules declared with define()... At least, until browsers implement | |
* ES6 Modules. | |
*/ | |
define("mymodule", function( | |
r = require, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() | |
{ | |
var wrappedPromiseConstructor = Promise; | |
Promise = function(...args) | |
{ | |
// Do whatever you want here | |
console.log("trapped"); | |
var func = args[0]; | |
args[0] = function(resolve, reject) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var symbol = Symbol("foo"); | |
var object = { | |
"key": "value", | |
set value(val) { | |
return this.value = val; | |
}, | |
[symbol]: (bar) => "" + bar | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [1,2,3].equals([1,2,3]); // true | |
* [1,2,3].equals([1,2]); // false | |
* [1,2,3].equals([1,2,4]); // false | |
* [1,2,3].equals("123"); // false | |
* Array.prototype.equals.call("123", "123"); // true | |
* Array.prototype.equals.call("123", [1,2,3]); // false | |
* [1,2,3].equals([1,2,{value: 3}], (x, y) => (x.value || x) === (y.value || y)); // true | |
*/ | |
Array.prototype.equals = function (other, callback = (x, y) => (x === y)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']}); | |
const page = await browser.newPage(); | |
await page.goto('https://dofusama.fr/treasurehunt/stats/tous-les-indices.html') | |
const href = await page.evaluate(async () => { | |
const link = document.querySelectorAll('table a')[0] | |
return Promise.resolve(link.href); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !IMPORTANT | |
# Adapt the model gpt-4o to gpt-4o-mini when the translated file is larger than 4096 tokens | |
import os | |
import openai | |
from pathlib import Path | |
import json | |
import argparse | |
import datetime |