Skip to content

Instantly share code, notes, and snippets.

@chandu
chandu / using_git-svn.md
Created May 7, 2020 18:31 — forked from rickyah/using_git-svn.md
A simple guide to git-svn

#Getting started with git-svn

git-svn is a git command that allows using git to interact with Subversion repositories.git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

Reference: http://git-scm.com/book/en/v1/Git-and-Other-Systems-Git-and-Subversion

##Cloning the SVN repository

You need to create a new local copy of the repository with the command

@chandu
chandu / spring-boot-cheatsheet.java
Created February 7, 2020 16:03 — 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);
}
}
@chandu
chandu / System Design.md
Created January 22, 2020 20:23 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@chandu
chandu / SwtBrowserCanvas.java
Created December 5, 2019 16:53 — forked from caprica/SwtBrowserCanvas.java
Embed an SWT Webkit Browser component inside a Swing JPanel, with non-crashing clean-up.
/*
* This class is made available under the Apache License, Version 2.0.
*
* See http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Author: Mark Lee
*
* (C)2013 Caprica Software (http://www.capricasoftware.co.uk)
*/
@chandu
chandu / ReflectionHelpersSnippet.scala
Created June 12, 2019 13:38 — forked from ConnorDoyle/ReflectionHelpersSnippet.scala
Generic reflective case class instantiation with Scala 2.10.x
package test
import scala.reflect.runtime.universe._
object ReflectionHelpers extends ReflectionHelpers
trait ReflectionHelpers {
protected val classLoaderMirror = runtimeMirror(getClass.getClassLoader)
@chandu
chandu / anorm.scala
Created April 3, 2019 01:09 — forked from davegurnell/anorm.scala
A short guide to Anorm
/*
Overview
--------
To run a query using anorm you need to do three things:
1. Connect to the database (with or without a transaction)
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator
3. Call one of the methods on `SqlQuery` to actually run the query
@chandu
chandu / auxpattern.scala
Created January 19, 2019 00:28 — forked from gigiigig/auxpattern.scala
Aux Pattern
import shapeless._
import scalaz._
import Scalaz._
object console extends App {
trait Foo[A] {
type B
def value: B
@chandu
chandu / Extends.scala
Created July 5, 2018 08:02 — forked from rjsen/Extends.scala
Macro annotation to eliminate case class repetition
import scala.annotation.{StaticAnnotation, compileTimeOnly}
import scala.language.experimental.macros
import scala.reflect.macros.whitebox.Context
@compileTimeOnly("use macro paradise")
class Extends[T](defaults: Any*) extends StaticAnnotation {
def macroTransform(annottees: Any*): Any = macro Extends.impl
}
object Extends {
@chandu
chandu / BinTreeIterator.scala
Created April 23, 2018 01:30 — forked from akihiro4chawon/BinTreeIterator.scala
Tree traversal comparison: stream vs explicit state stack
object BinTreeIterator {
sealed trait Tree
case class Node(v: Int, l: Tree, r: Tree) extends Tree
case object Leaf extends Tree
def toIterator(node: Tree): Iterator[Int] = {
def toStream(n: Tree): Stream[Int] = n match {
case Node(v, l, r) => v #:: toStream(l) #::: toStream(r)
case Leaf => Stream.empty
}
@chandu
chandu / FinanceDSL.scala
Created March 22, 2018 01:02 — forked from btlines/FinanceDSL.scala
FinanceDSL using type-classes
object FinanceDSL extends App {
trait PrettyPrint[A] {
def prettify(a: A): String
class Ops(a: A) {
def pretty: String = prettify(a)
}
}
object PrettyPrint {