Skip to content

Instantly share code, notes, and snippets.

View IkeyBenz's full-sized avatar

Isaac Benzaken IkeyBenz

  • New York
View GitHub Profile
@IkeyBenz
IkeyBenz / make-relative-imports-absolute.js
Last active August 26, 2021 00:41
make-relative-imports-absolute.js
/**
* This script is intended to convert all relative imports in this project into
* absolute imports from the reference of the 'src' directory.
*
* Additional rules:
* - Files in src/core should not be effected
*/
const fs = require('fs');
const path = require('path');
@IkeyBenz
IkeyBenz / make-relative-imports-absolute.ts
Created August 26, 2021 00:21
make-relative-imports-absolute.ts
/**
* This script is intended to convert all relative imports in this project into
* absolute imports from the reference of the 'src' directory.
*
* Additional rules:
* - Files in src/core should not be effected
*/
import fs from 'fs';
import path from 'path';
/*
Use your custom theme:
Select "Custom" theme in the dashboard
On your https://poll.ma.pe/overlay/<id>/ URL add ?customCss=https://example.com/style.css
Please keep the link to https://poll.ma.pe visible for a short period of time.
*/
@import url(https://fonts.googleapis.com/css?family=Abel);
Concurrent programming is programming that is concurrent.
@IkeyBenz
IkeyBenz / convert_react_js_to_typescript.py
Last active February 28, 2020 00:45
Convert all files in react directory from javascript to typescript
from os import listdir, system
from os.path import isdir, join
# Source: react-js-to-ts - https://www.npmjs.com/package/react-js-to-ts
# Source: js-to-ts-converter - https://www.npmjs.com/package/js-to-ts-converter
def get_filepaths(folder_path):
filepaths = []
for filepath in listdir(folder_path):
complete_path = join(folder_path, filepath)
@IkeyBenz
IkeyBenz / int_to_roman_numeral.py
Last active November 5, 2019 19:24
Coding Challenge: Convert integers into roman numerals (Python)
def convert_to_roman(num: int) -> str:
'''Takes an integer and returns its value in roman numerals'''
conversion_table = [
(1000, 'M'), (900, 'CM'),
(500, 'D'), (400, 'CD'),
(100, 'C'), (90, 'XC'),
(50, 'L'), (40, 'XL'),
(10, 'X'), (9, 'IX'),
(5, 'V'), (4, 'IV'),
@IkeyBenz
IkeyBenz / frequent_words.py
Created July 5, 2019 22:22
Breakout Problem
def frequent_words(text, k):
frequencies = {}
most_frequent = []
words = text.split(" ")
for word in words:
if word not in frequencies:
frequencies[word] = 0
frequencies[word] += 1
@IkeyBenz
IkeyBenz / user.controller.js
Last active April 17, 2019 18:21
Signup Refactor
// OLD CODE
const SignUp = async (req, res) => {
// Check if the user already exists
const user = await User.findOne({ email: req.body.email }, 'email password name');
if (user) {
user.comparePassword(req.body.password, (error, matched) => {
if (error) {
if (req.is('application/json')) {
return res.json({ error: 'Account with that email address already exists.' });
}