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
using System.Windows; | |
using System.Windows.Controls; | |
namespace CustomControl | |
{ | |
public class BindablePasswordBox : Decorator | |
{ | |
/// <summary> | |
/// The password dependency property. | |
/// </summary> |
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
def fib(n: Int): Long = n match { | |
case _ if n <= 1 => n | |
case _ => fib(n-1) + fib(n-2) | |
} |
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 sys | |
# Facebook Hacker Cup Qualification Round - Studious Student | |
# http://www.facebook.com/hackercup/problems.php?round=4 | |
def lex_compare(x, y): | |
if x.startswith(y) and x != y: | |
return lex_compare(x[len(y):], y) | |
if y.startswith(x) and y != x: |
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 sys | |
# Facebook Hacker Cup Online Round 1a - After the Dance Battle | |
# http://www.facebook.com/hackercup/problems.php?round=144428782277390 | |
def dijkstra(graph, start, end): | |
dist = {} | |
previous = {} | |
for v in graph.keys(): |
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 sys | |
from fractions import Fraction | |
# Facebook Hacker Cup Online Round 1a - First or Last | |
# http://www.facebook.com/hackercup/problems.php?round=144428782277390 | |
def main(): | |
with open(sys.argv[1]) as fp: | |
input = fp.read().split() |
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
public class Spiral { | |
public static void main(String[] args) { | |
int row = Integer.parseInt(args[0]); | |
int col = Integer.parseInt(args[1]); | |
int[][] matrix = new int[row][col]; | |
for (int i = 0; i < row; i++) { | |
for (int j = 0; j < col; j++) { | |
matrix[i][j] = i * col + j + 1; |
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
object FizzBuzz { | |
def main(args: Array[String]) { | |
for (i <- 1 to 100) { | |
(i % 3, i % 5) match { | |
case (0, 0) => println("FizzBuzz") | |
case (0, _) => println("Fizz") | |
case (_, 0) => println("Buzz") | |
case _ => println(i) | |
} | |
} |
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
package sugar | |
import org.slf4j.{Logger, LoggerFactory} | |
trait LoggingSugar { | |
/** | |
* This is just a convenience method so you can type: | |
* | |
* getLogger[Foo] |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.yourdomain</groupId> | |
<artifactId>yourdomain</artifactId> | |
<packaging>jar</packaging> | |
<name>YourName</name> |
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
def notifySync(notice: AirbrakeNotice): Validation[Throwable, Int] = { | |
notify(prepareRequest(notice)).unsafePerformIO | |
} | |
def notify(xml: NodeSeq): IO[Validation[Throwable, Int]] = { | |
sendNotification(xml).map(_.success[Throwable]).except(_.fail[Int].pure[IO]) | |
} | |
def sendNotification(xml: NodeSeq): IO[Int] = io { | |
. . . |
OlderNewer