Skip to content

Instantly share code, notes, and snippets.

View sicknarlo's full-sized avatar

Nick Sarlo sicknarlo

  • Philadelphia, PA
View GitHub Profile
@sicknarlo
sicknarlo / preact-google-translate-patch.ts
Created August 11, 2022 16:21
Preact Google Translate Patch
const insertBefore = Element.prototype.insertBefore;
Element.prototype.insertBefore = function <T extends Node>(
newNode: T,
referenceNode: Node | null,
): T {
if (
newNode instanceof Text &&
referenceNode instanceof HTMLElement &&
referenceNode?.localName === 'font'
@sicknarlo
sicknarlo / recurrence_relation
Created March 26, 2015 00:55
Prints the recurrence relation to the nth term
# Prints out recurrence relation based on 3 inputs: operations, relation, and term
# get input of operations
operations = input()
#split operations by space into list
op_list = operations.split(' ')
# get initial number
init = input()
@sicknarlo
sicknarlo / fizzbuzz
Created December 17, 2014 19:32
[CodeEval] Fizz Buzz
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main(){
int line_count = 1;
@sicknarlo
sicknarlo / lowercase
Created December 17, 2014 19:32
[CodeEval] Lower Case
//Change all letters to lower case
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(){
string str;
@sicknarlo
sicknarlo / rollercoaster
Created December 17, 2014 19:30
[CodeEval] Roller Coaster
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;
int isLetter(int sasi);
//Tests to see if the character is a letter
int isUpper(int sasi);
@sicknarlo
sicknarlo / sumofint
Created December 17, 2014 15:45
[CodeEval] Sum of Integers From File
//Print out the sum of integers read from a file.
#include<iostream>
using namespace std;
int main(){
int sum = 0, n;
while (cin >> n){
@sicknarlo
sicknarlo / oddnum
Created December 17, 2014 15:42
[CodeEval] Odd Numbers
//Print the odd numbers from 1 to 99.
#include<iostream>
using namespace std;
int main(){
for (int i = 1; i < 100; i++){
@sicknarlo
sicknarlo / sherlock
Created December 17, 2014 15:30
[HackerRank] *INCOMPLETE - TIMEOUT* Sherlock and Squares
/* Watson gives two integers A & B to Sherlock and asks if he can count the number
of square integers between A and B (both inclusive).
A square integer is an integer which is the square of any integer. For example, 1,
4, 9, 16 are some of the square integers as they are squares of 1, 2, 3, 4 respectively.
Input Format
First line contains T, the number of testcases. T test cases follow, each in a newline.
Each testcase contains two space separated integers denoting A and B.
@sicknarlo
sicknarlo / altchar
Created December 17, 2014 15:28
[HackerRank] Alternating Characters
/* Shashank likes strings in which consecutive characters are different. For example,
he likes ABABA, while he doesn't like ABAA. Given a string containing characters A and
B only, he wants to change it into a string he likes. To do this, he is allowed to
delete the characters in the string.
Your task is to find the minimum number of required deletions. */
#include<iostream>
#include<string>