Skip to content

Instantly share code, notes, and snippets.

package test;
public class Test {
String s = // 10,000 chars long string
String substr = s.substring(1);
}
@SurfV
SurfV / JAXBMarshallerUnmarshaller.java
Last active February 12, 2021 14:36
JAXB marshall/unmarshall
public class JAXBMarshallerUnmarshaller {
public SomeJaxbResponse unmarshal() throws JAXBException, FileNotFoundException {
final JAXBContext context = JAXBContext.newInstance(SomeJaxbResponse.class);
return (SomeJaxbResponse) context.createUnmarshaller()
.unmarshal(new FileReader("./someEndpointResponse.xml"));
}
public void marshal() throws JAXBException {
final SomeJaxbResponse someJaxbResponse = new SomeJaxbResponse();
final OutputRoot outputRoot = new OutputRoot();
@SurfV
SurfV / load-data-from-resource.java
Last active May 24, 2021 15:12
load-data-from-resource
public class Demo {
public final static String resourceURI = "classpath:/file_info.html";
public final static String EMPTY_STRING = "";
@Autowired
private ResourceLoader resourceLoader;
public String getSpringResource(final String resourceURI) {
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@SurfV
SurfV / Squash.md
Last active February 23, 2024 11:58
Squash the changes into the new branch

Squash changes

Git Merge Approach

The git merge approach is as follows:

git checkout <branch_name_into_which_you_want_to_merge>
git merge --squash <branch_name_to_be_squashed>