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:

@behrangsa
behrangsa / login-form.js
Created June 25, 2011 22:52
JavaScript
(function() {
/**
* Adds an animation effect to the given input element's label so that when some text
* is entered in the field, the label moves up and when the field is empty, the label
* goes back to its initial place. This function only works with the accompanying CSS
* styles.
*/
function installAnimation(inputElem, marginTopEnd, animationLength) {
$(inputElem).bind('input', function() {
var label = $(this).prev("label");
@behrangsa
behrangsa / Main.java
Last active September 22, 2021 14:48
Console based Spring Boot app
@SpringBootApplication
public class Main {
public static void main(String[] args) {
final ConfigurableApplicationContext context = SpringApplication.run(Main.class, args);
final AppBean app = context.getBean(AppBean.class);
app.run(args);
}
}
@behrangsa
behrangsa / ChromeDriverTester.groovy
Created August 1, 2012 11:11
A groovy script for testing ChromeDriver
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
@Grapes(
@Grab(
group='org.seleniumhq.selenium',
module='selenium-chrome-driver',
version='2.5.0'
)
@behrangsa
behrangsa / pom.xml
Created June 27, 2011 12:37
maven-glassfish-plugin configuration
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<user>${domain.username}</user>
<passwordFile>${glassfish.home}/domains/${project.build.finalName}/master-password</passwordFile>
<autoCreate>true</autoCreate>
<debug>true</debug>
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:
#