Skip to content

Instantly share code, notes, and snippets.

View ybiquitous's full-sized avatar

Masafumi Koba ybiquitous

View GitHub Profile
@ybiquitous
ybiquitous / math.js
Last active August 29, 2015 14:06
JavaScript テストライブラリ使用例
module.exports = {
add: function(a, b) {
if (typeof a === 'undefined' || a === null) a = 0;
if (typeof b === 'undefined' || b === null) b = 0;
return Number(a) + Number(b);
}
};
@ybiquitous
ybiquitous / PaginatedResultSetExtractor.java
Last active August 29, 2015 14:07
PaginatedResultSetExtractor (Spring JDBC)
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.jdbc.core.RowMapper;
public final class PaginatedResultSetExtractor<T> implements ResultSetExtractor<List<T>> {
@ybiquitous
ybiquitous / jndi.jsp
Last active August 29, 2015 14:10
JNDI listing JSP
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="javax.naming.*"%>
<!DOCTYPE html>
<html>
<head><title>JNDI list</title></head>
<body>
<h1>JNDI list</h1>
<%
String root = request.getParameter("root");
if (root == null) {
root = "";
input {
width: 10em;
}
input:invalid {
box-shadow: 0 0 0.5em red;
}
input ~ [data-hint] {
left: -5em;
}
(flycheck-def-config-file-var flycheck-sass-lintrc sass-lint ".sass-lint.yml"
:safe #'stringp)
(flycheck-define-checker sass-lint
"A SASS (SCSS) checker using Sass Lint (on Node.js).
See URL `https://github.com/sasstools/sass-lint'."
:command ("sass-lint"
"--verbose"
"--format" "checkstyle"
body {
background-color: #fff;
}
.hr-text {
text-align: center;
border: 0;
border-top: 1px solid #bbb;
height: 0;
}
.hr-text:after {
@ybiquitous
ybiquitous / index.html
Created September 23, 2016 04:27
document.styleSheets
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>document.styleSheets</title>
<link href="style1.css" rel="stylesheet">
<link href="style2.css" rel="stylesheet">
</head>
<body>
<h1>Test</h1>
@ybiquitous
ybiquitous / off-canvas.html
Created February 9, 2017 04:54
Off canvas - Responsive pattern
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Off canvas - Responsive pattern</title>
<style>
body {
display: flex;
}
@ybiquitous
ybiquitous / npm-open.bash
Last active January 16, 2018 01:49
Open NPM package's URL
# Usage: npm-open <package>
function npm-open() {
[ -n "$1" ] && npm info "$1" homepage repository.url | head -1 | cut -d ' ' -f 3 | xargs open
}
@ybiquitous
ybiquitous / README.markdown
Last active February 5, 2018 07:50
`markdownlint --ignore` behavior
$ npm install
$ npm test

> @ test /private/tmp/foo
> sh ./test.sh


> @ eslint:rel /private/tmp/foo
> eslint --ignore-pattern a.js "*.js"