Please feel free to contribute! Improvements and/or new scenarios are most welcome.
- ListPosts
- AddPost
- EditPost
| # Print all project items | |
| Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" } | |
| # Function to format all documents based on https://gist.github.com/984353 | |
| function Format-Document { | |
| param( | |
| [parameter(ValueFromPipelineByPropertyName = $true)] | |
| [string[]]$ProjectName | |
| ) | |
| Process { |
| { | |
| "vars": { | |
| "@gray-darker": "lighten(#000, 13.5%)", | |
| "@gray-dark": "lighten(#000, 20%)", | |
| "@gray": "lighten(#000, 33.5%)", | |
| "@gray-light": "lighten(#000, 46.7%)", | |
| "@gray-lighter": "lighten(#000, 93.5%)", | |
| "@brand-primary": "#428bca", | |
| "@brand-success": "#5cb85c", | |
| "@brand-info": "#5bc0de", |
Caveat
The tables in this cheatsheet only make sense after you study all thes mentioned data structures and algorithms below.
Do not memorize them, learn how the underlying algorithms work, read the source.
This cheat sheet is just a quick reference to give an broad brush strokes overview of how the most frequently-used data structures and algorithms relate to each other, in terms of time and space complexity.
| @echo off | |
| REM Install Ghostscript 64bit from http://www.ghostscript.com/download/gsdnld.html | |
| REM Shrink all pdfs files in the current directory where this script is run and output to the | |
| REM compressed sub-folder | |
| setlocal | |
| set GS_BIN=C:\Program Files\gs\gs9.15\bin\gswin64c.exe | |
| set GS_OUTPUT_DIR=compressed | |
| mkdir %GS_OUTPUT_DIR% | |
| for %%i in (*.pdf) do "%GS_BIN%" -dNOPAUSE -dBATCH -dSAFER -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -sDEVICE=pdfwrite -sOutputFile="%GS_OUTPUT_DIR%\%%i" "%%i" |
| object FinanceDSL extends App { | |
| trait PrettyPrint[A] { | |
| def prettify(a: A): String | |
| class Ops(a: A) { | |
| def pretty: String = prettify(a) | |
| } | |
| } | |
| object PrettyPrint { |
| 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 | |
| } |
| 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 { |
| import shapeless._ | |
| import scalaz._ | |
| import Scalaz._ | |
| object console extends App { | |
| trait Foo[A] { | |
| type B | |
| def value: B |
| /* | |
| 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 |