Skip to content

Instantly share code, notes, and snippets.

// 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';
@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>
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
<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>
/* 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 {
@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>
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.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>
@seahrh
seahrh / README.md
Created January 28, 2018 01:22 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

use mydb;
set @s='pqrs';
set @d=11.11;
set @pk=15605;
INSERT INTO t1 (s,d,_fk) SELECT * FROM (SELECT @s, @d, @pk) AS tmp
WHERE NOT EXISTS (SELECT s FROM t1 WHERE s=@s and _fk=@pk) LIMIT 1;
commit;