Skip to content

Instantly share code, notes, and snippets.

View Animesh-Ghosh's full-sized avatar
🎯
Focusing

MaDDogx Animesh-Ghosh

🎯
Focusing
View GitHub Profile
@Animesh-Ghosh
Animesh-Ghosh / foobar.rb
Created October 23, 2024 18:01
Ruby WTF
def foo
return :bar
ensure
p :foo
end
foo # => :bar but prints :foo before returning
def foo
return :bar
@Animesh-Ghosh
Animesh-Ghosh / output.txt
Created May 9, 2024 18:17
001-explorer.exs output
Operating System: Linux
CPU Information: Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Number of Available Cores: 4
Available memory: 7.46 GB
Elixir 1.16.0
Erlang 26.2.1
JIT enabled: true
Benchmark suite executing with the following configuration:
warmup: 2 s
@Animesh-Ghosh
Animesh-Ghosh / test_payment_processor.py
Created November 19, 2022 04:17
Tests that got me a job 😎
'''Test for Payment Processor.
Author: Animesh Ghosh
'''
import unittest
from unittest.mock import patch
from io import StringIO
from payment_processor import PaymentProcessor
class TestPaymentProcessor(unittest.TestCase):
@Animesh-Ghosh
Animesh-Ghosh / Matrix.js
Created May 10, 2022 17:23
JavaScript Matrix class with usage examples
/**
* @classdesc a class for doing common Matrix operations
*
*/
class Matrix {
/**
* @param {Array} array a 2d array
*/
constructor(array) {
let numberOfColumns = array[0].length
@Animesh-Ghosh
Animesh-Ghosh / collection.json
Created November 8, 2021 18:13
Postman API Collection
{
"info": {
"_postman_id": "8eb00015-dbbe-4627-893b-d5bf948414e8",
"name": "Django Knuckle Snapper",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Login",
"request": {
@Animesh-Ghosh
Animesh-Ghosh / recursive_ctes.sql
Created July 25, 2021 12:08
Recursive Common Table Expressions
-- count till n
WITH RECURSIVE count_cte AS (
SELECT 1 AS n -- anchor member
UNION
SELECT n + 1 -- recursive member
FROM count_cte WHERE n < 10
) SELECT * FROM count_cte;
-- factorial
WITH RECURSIVE fact_cte AS (
#include <bits/stdc++.h>
using namespace std;
ostream& operator<<(ostream& os, const vector<int>& v) {
for (const int& x : v) {
os << x;
}
return os;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated SVG!</title>
<style type="text/css">
*, ::before, ::after {
margin: 0;
padding: 0;
import timeit
def main():
f = open('sum.py')
program = f.readlines()
f.close()
if __name__ == '__main__':
# takes ~17 seconds on i5 4440 @ 3.1 GHz with 8 GB DDR3 @ 1333 MHz
print(timeit.timeit(main, number=100000))
@Animesh-Ghosh
Animesh-Ghosh / index.html
Last active May 13, 2020 09:04
Facelift
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="author" content="Animesh Ghosh">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#24292e">
<title>GitHub API Wrapper</title>
<style type="text/css">
/* designing for mobile first */