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
// ==UserScript== | |
// @name Hide Twitter Replies (Home) | |
// @version 1 | |
// @description Hide all reply elements in a Twitter home page. | |
// @author Chun Rapeepat | |
// @match https://twitter.com/home | |
// @grant none | |
// ==/UserScript== | |
(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
javascript:( | |
function () { | |
if (document.designMode === "off") { | |
document.designMode = 'on'; | |
document.body.innerHTML += `<div id="dmbml" style="position:fixed;z-index:99999;background:white;color:black;top:-1px;left:-1px;border: 1px solid #ccc;font-family:sans-serif;">🎨 Design Mode = On<div>`; | |
void 0; | |
} else if (document.designMode === "on") { | |
document.designMode = 'off'; | |
document.getElementById('dmbml').remove(); | |
void 0; |
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 phrase = "A B C D E F G H I J K L" | |
const secret = "helloworld123" | |
console.log(`Phase = ${phrase}`) | |
console.log(`Secret = ${secret}`) | |
console.log(`Phase + Secret = ${encode(phrase, secret)} (<-- note this on paper)`) | |
if (phrase !== decode(encode(phrase, secret), secret)) { | |
console.log("ERROR") | |
} |
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 data = []; | |
var dataCount = 20; | |
var startTime = +new Date(); | |
var categories = ['14/2/2020']; | |
var types = [ | |
{name: 'Offline', color: 'red'}, | |
{name: 'Online', color: 'green'}, | |
]; | |
// Generate mock data |
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
Up: +4, Down: +3 | |
Embellishment Table: | |
1 b9 2 m3 M3 4 b5 5 #5 6 m7 M7 | |
8 9 11 b13 13 | |
Chord Voicing: | |
E: 1 5 8 3 (5) (8) |
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
// top-down approach | |
function maxSubarray(arr) { | |
const memo = {}; | |
let answer = Number.MIN_VALUE; | |
function _maxSubarray(arr, i) { | |
// base case | |
if (arr.length === 0) return 0; | |
if (i === 0) return arr[0]; | |
// induction case |
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
// top-down approach | |
const memo = {}; | |
function coinChange(n) { | |
// base case | |
if (n <= 0) return Number.MAX_VALUE; | |
if (n === 1 || n === 3 || n === 4) return 1; | |
// induction case | |
if (memo[n]) return memo[n]; | |
memo[n] = Math.min(...[coinChange(n-1), | |
coinChange(n-3), |
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 findFirstOne(arr) { | |
let L = 0; | |
let R = arr.length - 1; | |
let result = -1; | |
while (L <= R) { | |
let mid = Math.floor(L + (R - L) / 2); | |
if (arr[mid] === 1) { | |
result = mid; | |
R = mid - 1; | |
} else { |
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 hasSqrt(N) { | |
let L = 0; | |
let R = N; | |
while (L <= R) { | |
let mid = Math.floor(L + (R - L) / 2); | |
let sqare = Math.pow(mid, 2); | |
if (sqare === N) { | |
return true; | |
} else if (sqare < N) { | |
L = mid + 1; |
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
TITLE print the number | |
STACK SEGMENT STACK | |
dw 64 dup(?) | |
STACK ENDS | |
DATA SEGMENT | |
LINE db 3 dup(?),10,13,'$' | |
DATA ENDS |
NewerOlder