This file contains 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
import java.io.File | |
import scala.io._ | |
import scala.util.matching.Regex | |
def recursiveListFiles(f: File, r: Regex): Array[File] = { | |
val these = f.listFiles | |
val good = these.filter(f => r.findFirstIn(f.getName).isDefined) | |
good ++ these.filter(_.isDirectory).flatMap(recursiveListFiles(_,r)) | |
} | |
This file contains 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
import shapeless._ | |
import poly._ | |
import shapeless.ops.hlist.FlatMapper | |
object am { | |
/** | |
* A type class that helps us partially apply a polymorphic binary function | |
* to some value and map the resulting function (which of course isn't | |
* literally a Poly1) over an HList. |
This file contains 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
import shapeless._ | |
object cz { | |
trait ConstZipper[L <: HList, C] extends DepFn2[L, C] { type Out <: HList } | |
object ConstZipper { | |
type Aux[L <: HList, C, Out0 <: HList] = | |
ConstZipper[L, C] { type Out = Out0 } |
This file contains 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
import shapeless._; import syntax.singleton._; import record._ | |
object os { | |
trait OptionSelector[L <: HList, K] { | |
type Out | |
def apply(l : L): Out | |
} | |
trait LowPriorityOptionSelector { |
This file contains 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
import shapeless._ | |
import shapeless.ops.hlist.Tupler | |
import syntax.singleton._ | |
import record._ | |
object o { | |
trait Projection[F <: HList, L <: HList] extends DepFn1[L] { type Out <: HList} | |
object Projection{ | |
implicit def hnil[L <: HList] = new Projection[HNil, L]{ | |
override type Out = HNil |
This file contains 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
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> val i = 123 // значение для сравнения | |
i: Int = 123 | |
scala> def if_i_1(x: Int) = x match { case i => true; case _ => false } // Scala нас предупреждает, что притаком определении сравнение проводиться не будет! | |
<console>:10: warning: patterns after a variable pattern cannot match (SLS 8.1.1) | |
def if_i_1(x: Int) = x match { case i => true; case _ => false } |
This file contains 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
// from repl.it | |
function myClass() { | |
this.uniqueTask = function() { | |
return 2 | |
} | |
} | |
var obj = new myClass(); | |
obj.uniqueTask = function() { |
This file contains 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
import cats.Monad | |
import scala.concurrent.Future | |
import scala.language.higherKinds | |
import scala.concurrent.ExecutionContext.Implicits.global | |
object Swap { | |
def apply[F[_], A](l: List[F[A]])(implicit m: Monad[F]): F[List[A]] = |
This file contains 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
cmd://cmd /c "cmdkey /generic:TERMSRV/{URL:HOST} /user:{USERNAME} /pass:"{PASSWORD}" && mstsc /v:{URL:RMVSCM} && cmdkey /delete:TERMSRV/{URL:RMVSCM}" |
This file contains 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
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 } |
OlderNewer