Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Currie christophercurrie

View GitHub Profile
@christophercurrie
christophercurrie / lazyval.txt
Created Feb 17, 2014
Lazy val synchronization bitmap is not synthetic
View lazyval.txt
Welcome to Scala version 2.11.0-M8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class Foo { lazy val foo = "bar" }
defined class Foo
scala> classOf[Foo].getDeclaredFields
res0: Array[java.lang.reflect.Field] = Array(private java.lang.String Foo.foo, private volatile boolean Foo.bitmap$0)
View gist:10691032
56k: "https://123.campfirenow.com/images/56k.gif"
bell: ":bell:"
bezos: ":laughing::thought_balloon:"
bueller: "anyone?"
clowntown: "https://123.campfirenow.com/images/clowntown.gif"
cottoneyejoe: ":notes::hear_no_evil::notes:"
crickets: "hears crickets chirping"
dadgummit: "dad gummit!! :fishing_pole_and_fish:"
dangerzone: "https://123.campfirenow.com/images/dangerzone.png"
danielsan: ":fireworks: :trophy: :fireworks:"
View Document2.java
class Document2
{
@JsonCreator
public Document2(@JsonProperty("invalid") Double invalid)
{
// mark the value as invalid somehow
}
public void setValue1(int value1)
{
View calc.cpp
/*=============================================================================
Copyright (c) 2001-2010 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST
//
@christophercurrie
christophercurrie / post-receive-redmine.sh
Created Jan 10, 2012 — forked from colinmollenhour/post-receive-redmine.sh
gitolite update hooks to reject CRLF line endings and require formatted commit messages
View post-receive-redmine.sh
#!/bin/bash
#
# see https://github.com/kahseng/redmine_gitolite_hook/blob/master/README.rdoc
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
View TestKeySerializer.java
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.collect.ImmutableMap;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
@christophercurrie
christophercurrie / Install-WIF-OnAzure.ps1
Created Oct 8, 2012
Installing Windows Identity Foundation on Windows Azure (within a startup task)
View Install-WIF-OnAzure.ps1
$currentDir = (Get-Location -PSProvider FileSystem).ProviderPath
function SearchInstall($SearchVersion, $PathKey)
{
$installObjects = ls -path $PathKey;
$found = $FALSE;
foreach($installEntry in $installObjects)
{
$entryProperty = Get-ItemProperty -LiteralPath registry::$installEntry
View gist:4569300
<%def name="outer(x)">
<%def name="inner(y)">
values ${x} and ${y}
</%def>
${caller.body()}
</%def>
<%self:outer x="1">
<%self:inner y="${x + 1}" />
</%self:outer>
@christophercurrie
christophercurrie / cloudbees-jenkins-sbt.md
Created Apr 13, 2013
Configuring CloudBees Jenkins for SBT publishing
View cloudbees-jenkins-sbt.md

I want to use the CloudBees Jenkins service to build nightly snapshots of an SBT-based scala project and publish them to the Sonatype OSS Maven Repository. SBT has [two ways][credentials] of providing publishing credentials to the build; one has the credentials inline in an .sbt file (unencrypted, natch), and the other does allow for a hard-coded path to an external properties file (still, sadly, unencrypted).

CloudBees has a [mechanism][buildfiles] for providing configuration files to build agents, but I don't want to hard code the path to this location in my build.sbt, nor can I

@christophercurrie
christophercurrie / AsyncDownloadQueue.cs
Last active Dec 18, 2015
Various attempts at implementing an asynchronous download processor.
View AsyncDownloadQueue.cs
internal class BoundedAsyncDownload1
{
private const int MaxRequests = 4;
private void HandleResponse(WebResponse response)
{ }
private void CreateRequest(ConcurrentQueue<WebRequest> queue)
{
WebRequest request;