Skip to content

Instantly share code, notes, and snippets.

View hrabbasi7's full-sized avatar
🎯
Focusing

HRAbbasi hrabbasi7

🎯
Focusing
View GitHub Profile
@hrabbasi7
hrabbasi7 / gradle-cheatsheet.gradle
Created February 17, 2017 20:01 — forked from jahe/gradle-cheatsheet.gradle
Gradle Cheatsheet
// imports a couple of java tasks
apply plugin: "java"
// List available tasks in the shell
> gradle tasks
// A Closure that configures the sourceSets Task
// Sets the main folder as Source folder (where the compiler is looking up the .java files)
sourceSets {
main.java.srcDir "src/main"
@hrabbasi7
hrabbasi7 / mongodb-cheatsheet.sh
Created February 17, 2017 20:00 — forked from jahe/mongodb-cheatsheet.sh
MongoDB Cheatsheet
# Start MongoDB server
> mongod
# Start MongoDB CLI client
> mongodb
# Create or open database "myDatabase"
> use myDatabase
# Show a list of all databases
@hrabbasi7
hrabbasi7 / spring-data-cheatsheet.java
Created February 17, 2017 19:59 — forked from jahe/spring-data-cheatsheet.java
Spring Data Cheatsheet
// Model a m:n relationship where the corresponding relationship record would be deleted when a entity record is deleted
@Entity
public class Team {
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, mappedBy="teams")
private List<Match> matches;
}
@Entity
public class Match {
@ManyToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST })
@hrabbasi7
hrabbasi7 / spring-boot-cheatsheet.java
Created February 17, 2017 19:58 — forked from jahe/spring-boot-cheatsheet.java
Spring Boot Cheatsheet
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration
@SpringBootApplication
public class FooApplication {
public static void main(String[] args) {
// Bootstrap the application
SpringApplication.run(FooApplication.class, args);
}
}
@hrabbasi7
hrabbasi7 / npm-cheatsheet.sh
Created February 17, 2017 19:56 — forked from jahe/npm-cheatsheet.sh
NPM Cheatsheet
# List dependency tree
npm list
npm ls
# List only main dependencies
npm ls --depth=0
# List outdated dependencies (-l to display dependency type)
npm outdated -l
@hrabbasi7
hrabbasi7 / git-cheatsheet.sh
Created February 17, 2017 19:56 — forked from jahe/git-cheatsheet.sh
Git Cheatsheet
# Show status of current changes
git status
# Revert a single file to the last commit
git checkout <filename>
# Checkout pull request from GitHub
git fetch origin pull/<id>/head:<local-branchname-for-pr>
git checkout <local-branchname-for-pr>
@hrabbasi7
hrabbasi7 / git-cheatsheet.sh
Created February 17, 2017 19:56 — forked from jahe/git-cheatsheet.sh
Git Cheatsheet
# Show status of current changes
git status
# Revert a single file to the last commit
git checkout <filename>
# Checkout pull request from GitHub
git fetch origin pull/<id>/head:<local-branchname-for-pr>
git checkout <local-branchname-for-pr>