Skip to content

Instantly share code, notes, and snippets.

@kevingessner
kevingessner / gist:1229202
Created September 20, 2011 14:20
LambdaDisposable
private class LambdaDisposable<T> : IDisposable
{
private Action<T> dispose_;
public T Value
{
get;
private set;
}
@kevingessner
kevingessner / server error.log
Created February 24, 2012 19:03
_routing error with child documents
org.elasticsearch.index.mapper.MapperParsingException: External routing [p1] and document path routing [1] mismatch
at org.elasticsearch.index.mapper.internal.RoutingFieldMapper.validate(RoutingFieldMapper.java:176)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:485)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:417)
at org.elasticsearch.index.shard.service.InternalIndexShard.prepareIndex(InternalIndexShard.java:305)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:202)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:529)
at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:427)
at java.util.conc
using System;
using System.Linq;
namespace Kiln.Utils
{
public static class Func
{
public static Func<T, bool> Not<T>(Func<T, bool> predicate)
{
return o => !predicate(o);
@kevingessner
kevingessner / parent.htm
Created May 17, 2013 13:09
Detect browser zoom in javascript 'zoom' event is triggered on window on every browser zoom change. No polling!
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<iframe id="frame" style="width: 250px; border: solid 1px red;" ></iframe>
<script type="text/javascript">
var elFrame = $('#frame')[0];
$(elFrame.contentWindow).resize(function() {
$(window).trigger('zoom');
php > $a = [['foo' => 'bar']];
php > foreach ($a as $b) $b['foo'] = 'quux';
php > print_r($a);
Array
(
[0] => Array
(
[foo] => bar
)
@kevingessner
kevingessner / gist:9509148
Last active April 27, 2023 15:45
Responsive emails that really work -- From Etsy's Code As Craft blog: http://codeascraft.com/2014/03/13/responsive-emails-that-really-work
<html>
<head>
<style type="text/css">
table table {
width: 600px !important;
}
table div + div { /* main content */
width: 65%;
float: left;
}
<!DOCTYPE html>
<html>
<head>
<title>Sea Change</title>
<style>
body {
background: #335;
text-align: center;
}
</style>
<?php
class × {
static function ¼($n) {
return $n/4;
}
static function ½($n) {
return $n/2;
}
diff --git a/test/scala/com/github/johnynek/bazel_deps/NormalizerTest.scala b/test/scala/com/github/johnynek/bazel_deps/NormalizerTest.scala
index c8fe497..cc1e42a 100644
--- a/test/scala/com/github/johnynek/bazel_deps/NormalizerTest.scala
+++ b/test/scala/com/github/johnynek/bazel_deps/NormalizerTest.scala
@@ -21,6 +21,7 @@ class NormalizerTest extends FunSuite {
val bird1 = "a:bird:1.0"
val bird2 = "a:bird:2.0"
val seed1 = "a:seed:1.0"
+ val dog1 = "a:dog:1.0"
/**
JAVACOPTS = [ ... ]
def java_library(javacopts = [], **kwargs):
"""Loaded by prelude_bazel to shadow the existing `java_library` and add additional javacopts when building local java code."""
updated_opts = []
updated_opts += javacopts
if native.repository_name() == "@":
# When building any java target in our repository (i.e. not ones that are loaded into the WORKSPACE with
# http_archive and friends), apply our javac options. We don't apply them to external code because that code
# may not adhere to our rules.