Skip to content

Instantly share code, notes, and snippets.

View behrangsa's full-sized avatar
💾

Behrang Saeedzadeh behrangsa

💾
View GitHub Profile
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class Node<T> {
private static final int DEFAULT_MODIFIER = 0;
private static final int DEFAULT_PRELIM = 0;
@behrangsa
behrangsa / java-vs-ts.txt
Last active February 13, 2023 04:19
ChatGPT Poems
In a world of code, where languages reign,
There's one that rises above the rest, it's plain,
A giant among giants, it's called Java,
A language that's been around, a classic, never to fade away.
It's strong, it's fast, it's versatile and flexible,
With a community so vast, it's truly remarkable,
It's been the backbone of many a great app,
Making it the king of the programming world, no need to clap.
@behrangsa
behrangsa / routing-01.md
Last active January 28, 2023 14:18
React.js tutorials generated by ChatGPT

Routing 101

React Router is a library that allows you to handle routing within a React application. It provides a way to map URLs to components, so that when a user navigates to a certain URL, the corresponding component will be displayed.

To get started with React Router, you'll first need to install it. You can do this by running the following command in your terminal:

npm install react-router-dom
@behrangsa
behrangsa / esm.md
Created December 20, 2022 12:23
What is an ESM module?

What is an ESM module?

ESMs (ECMAScript modules) are the official standard format to package JavaScript code for reuse. Modules are defined using import and export statements. 1

Default exports in ESM

The way we export "things" from our libraries impacts the way they can get imported by clients of our libraries.

For example, if we define a module and export cheese from it as the default export:

package xyz.behrang.uploader;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublisher;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
@behrangsa
behrangsa / download-arxiv.sh
Last active November 29, 2019 00:09
download-arxiv.sh
#!/bin/bash
# A simple script for downloading files from the arXiv S3 bucket (s3://arxiv)
#
# Author: Behrang Saeedzadeh
# Copyright (c) 2019, Behrang Saeedzadeh
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@behrangsa
behrangsa / a-good-test-case.md
Created June 23, 2019 03:35
A good test case
@Test
public void showProject_shouldReturnAccessDenied_forUnauthenticatedUser() {
    // Given an unauthenticated get project request
    HttpEntity request = unauthenticatedRequest("GET /projects/1");

    // When the request is handled by the application
    ResponseEntity<ErrorResponse> response = handleRequest(request);

    // Then a forbidden response should be returned
/*-----------------------------------------------------------*/
/*--- A block-sorting, lossless compressor bzip.c ---*/
/*-----------------------------------------------------------*/
/*--
This program is BZIP, a lossless, block-sorting data compressor,
version 0.21, dated 25-August-1996.
Copyright (C) 1996 by Julian Seward.
Department of Computer Science, University of Manchester,
@behrangsa
behrangsa / sample.xsd
Created March 31, 2019 05:55
Sample XSD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://example.com"
xmlns:mstns="http://example.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
targetNamespace="http://example.com"
elementFormDefault="qualified" id="Example">
<xs:element name="Example_Parent">
<xs:complexType>
<xs:choice>