This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait UnapplyMT[TC[_[_[_], _]], N[_], MTNA] { | |
| /** the type constructor */ | |
| type MT[_[_], _] | |
| /** The type that MT is applied to */ | |
| type A | |
| /** The instance of the type class */ | |
| def TC: TC[MT] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (global-set-key (kbd "M-?") 'flash-active-buffer) | |
| (make-face 'flash-active-buffer-face) | |
| (set-face-attribute 'flash-active-buffer-face nil | |
| :background "red" | |
| :foreground "black") | |
| (defun flash-active-buffer () | |
| (interactive) | |
| (run-at-time "100 millisec" nil | |
| (lambda (remap-cookie) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| process, absent anything else, is strictly pull | |
| you should think of run like a giant wheel that is spinning and pulling in some rope, which is the process | |
| the other end of that rope MAY be attached to a queue | |
| you're pulling from that queue | |
| and there may be an observer sitting on the rope which pushes into another queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Creating a generic recursive data structure with autoclosure. (READ ALL NOTES; THIS MAY NOT DO WHAT YOU WANT.) | |
| // Closures are reference types, so the size is known (? I think ?) | |
| // Note that this is just because of unimplemented features in the compiler in Beta5 | |
| // There's no reason to think this is a long-term requirement. | |
| // IMPORTANT: the closure will run every time you access this value, so if that has | |
| // side effects, this won't work. It's only possible on pure value types. | |
| // But the fact that this works as expected is actually kind of incredible. | |
| // Think about what is required for it to work out the type for NestedList.Elem("first"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // An ADT+shapeless as a drop-in replacement for a standard Scala Enumeration. | |
| // | |
| // First the unsafe standard Scala Enumeration ... | |
| // | |
| object ScalaEnumDemo extends App { | |
| // Example from scala.Enumeration scaladoc. Terse ... | |
| object WeekDay extends Enumeration { | |
| type WeekDay = Value | |
| val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mvn -Dtest=MyTest test | |
| mvn -pl specific_project goal | |
| mvn -Dmaven.test.skip=true install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clone with following remote submodules: | |
| git clone git://github.com/stevej/emacs.git .emacs.d --recursive | |
| update repo following remote submodules: | |
| git submodule update --init --recursive | |
| checkout remote branch | |
| git checkout -b local-name origin/remote-name | |
| delete remote branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed abstract class MyEnum | |
| object MyEnum { | |
| def apply(str :String) :MyEnum { // do str conversions } | |
| object Val1 extends MyEnum | |
| object Val2 extends MyEnum | |
| } | |
| we need the abstract class for matching the enum type. It can't be a trait because the compiler gets confused with the apply method in the object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| v. 1.2.2 plugin dependencies are declared in application.properties | |
| v. 1.3.7 plugin dependencies are declared in BuildConfig.groovy | |
| null safe object navigation obj?.value | |
| condensed ternary operator obj.value ?: "else this" | |
| comparison <=> | |
| call method on all objects in list listofobjs*.method | |
| add items to list lst << "new item" | |
| ranges .. ..< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| child selector > | |
| #parent > child | |
| :last selector | |
| #parent > *:last | |
| selects the last child of parent |
OlderNewer