Skip to content

Instantly share code, notes, and snippets.

@seahrh
seahrh / logback.xml
Last active January 15, 2018 08:15
Simple logback.xml
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
import net.datastructures.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
/**
* An realization of a graph according to adjacency list structure.
* Modified to use a map from vertex names to vertices instead of a
* NodePositionList to hold the vertices.
* Assumes that vertex values are unique.
@seahrh
seahrh / logback_disable_in_unit_tests.md
Created April 25, 2017 12:06 — forked from traviskaufman/logback_disable_in_unit_tests.md
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
/* Class names use Block-Element-Modifier (BEM) notation */
.ag-sections__section,
.ag-sections__section--red,
.ag-sections__section--green,
.ag-sections__section--yellow {
padding: 10px;
margin: 10px;
}
.ag-sections__section--red {
<div class="container ag-sections">
<div class="row">
<div class="col-xs-4 ag-sections__section--red">
<h1 class="ag-sections__section__heading">SECTION A</h1>
<div class="ag-sections__section__body">This section is Section A.</div>
<div class="ag-sections__section__footer">Section A is red.</div>
</div>
<div class="col-xs-4 ag-sections__section--yellow">
<h1 class="ag-sections__section__heading">SECTION B</h1>
<div class="ag-sections__section__body">This section is Section B.</div>
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
@seahrh
seahrh / demo.html
Created June 17, 2015 04:06
paper-drawer-panel
<!doctype html>
<html>
<head>
<title>paper-drawer-panel demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="vendor/webcomponentsjs/webcomponents-lite.min.js"></script>
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';