Skip to content

Instantly share code, notes, and snippets.

View FermiDirak's full-sized avatar
🚴
gone cycling

Bryan Manuele FermiDirak

🚴
gone cycling
View GitHub Profile
@FermiDirak
FermiDirak / Threshhhh.jsx
Last active February 10, 2020 06:48
esh esh esh esh esh
/** Proposal for new JSX syntax for css */
import * as React from 'react';
import {css} from '@emotion/core';
import Avatar from "./Avatar";
import Text from "./Text";
type Props = {
name: string,
email: string,
import {readFileSync} from 'fs';
const inputs = readFileSync('./day5-1.txt', 'utf8').split('\n');
const program = inputs[0].split(',').map(num => Number.parseInt(num));
/** Parses an operation for the opCode and parameter position / immediate modes */
function parseOperation(operation: number) {
function getNthDigit(num: number, digit: number) {
return Math.floor(num % (10 ** (digit + 1)) / (10 ** digit));
}
var balancedString = function(s) {
const n4 = s.length / 4;
s = s.split('');
const balance = {
Q: 0,
W: 0,
E: 0,
R: 0,
}
/**
* TEAM: frontend_infra
*
* @flow
*/
/* eslint-disable no-console */
/**
* This script will force relative imports to be fully
* specified imports. For instance, ./ComponentName might
var queensAttacktheKing = function(queens, king) {
function inBounds([x, y]) {
return x >= 0 && x < 8 && y >= 0 && y < 8;
}
function isQueen([x, y]) {
return queens.some(queen => {
return queen[0] === x && queen[1] === y;
});
}
var rob = function(nums) {
if (nums.length <= 2) {
return Math.max(...nums, 0);
}
const cache = [nums[0], nums[1]];
const dfs = (i) => {
const nextPositions = [i + 2, i + 3];
nextPositions.forEach(nextPos => {
var nthUglyNumber = function(n, a, b, c) {
const inputs = [a, b, c];
const curr = [a, b, c];
let counter = n;
while (counter !== 1) {
const sorted = curr.slice().sort((a, b) => a > b ? 1 : -1);
let min = sorted[0];
let minIndex = curr.findIndex((a) => a === min);
/**
* @param {number[]} arr
* @param {number} k
* @return {number}
*/
var kConcatenationMaxSum = function(arr, k) {
const anyNegative = arr.some(a => a < 0);
if (!anyNegative) {
return (arr.reduce((a, b) => a + b, 0) * k) % 1000000007;
@FermiDirak
FermiDirak / NYTPaywallWorkaround.md
Created May 19, 2019 03:44
Steps to get around NYT Paywall

A step by step guide wallthrough on how to access / read a NYT paywalled article

  1. Open the NYT article you want to read in incognito mode
  2. Open up your devtool console ([cmd][shift][j] on chrome/mac)
  3. Open up the devtools command prompt ([cmd][shift][P] on chrome/mac)
  4. Type in the command disable javascript into the command prompt, but don't hit enter
  5. Reload the page
  6. After the content loads but before the paywall appears, enter your disable javascript command
  7. If paywall persists, return to step 3. Otherwise, enjoy your free article.
  8. Happy reading!
type Props = {
name?: string,
nick?: number,
}
export default function NameDisplay({
name='',
nick='',
}: Props) {
return (