Skip to content

Instantly share code, notes, and snippets.

View christo's full-sized avatar
💭
follows you

Chris Mountford christo

💭
follows you
View GitHub Profile
@christo
christo / gist:86245bff11846e21a1171c4ea46f56ac
Last active September 17, 2024 05:44
Demonstrates problem using hakyll with .md file extension for markdown files
#!/usr/bin/env bash
# for me generated example passes but modified example fails
testdir="$(date +%s)-test"
function check() {
if !(cabal build && site rebuild && site check); then
popd; echo; echo failed on $1; exit 1
else
echo; echo success on $1
var scanx = 0;
var amp;
var cy;
var cx;
function setup() {
createCanvas(800, 800);
background(100);
reset();
}
@font-face {
font-family: 'Montserrat';
font-style: normal;
font-weight: normal;
src: local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v13/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2) format('woff2');
}
@font-face {
font-family: 'Montserrat';
font-style: italic;
font-weight: normal;

Keybase proof

I hereby claim:

  • I am christo on github.
  • I am christo (https://keybase.io/christo) on keybase.
  • I have a public key whose fingerprint is F3D2 EE98 1CA2 521D 6532 A44E 8A98 0E10 FE38 1E8E

To claim this, I am signing this object:

@christo
christo / ignoringExample.groovy
Last active December 16, 2015 13:29
Example groovy code ignoring exceptions.
class Config {
def threads = 8
// ...
def configure(Map config) {
try {
threads = Integer.parseInt(config?.threads as String)
} catch (NumberFormatException ignore) {
@christo
christo / ignoring.groovy
Last active April 1, 2020 21:54
Some compact Groovy syntax to ignore specific exceptions.
// you can make a construct for those
// times you want to ignore exceptions:
// here's the closure that can ignore things
def ignoring = { Class<? extends Throwable> catchMe, Closure callMe ->
try {
callMe.call()
} catch(e) {
if (!e.class.isAssignableFrom(catchMe)) {
throw e
@christo
christo / jxs.groovy
Created December 17, 2012 05:54
jira xml scaler reads a JIRA XML backup and gives you basic stats on the number of key domain objects in the backup.
def xml = new XmlSlurper().parse(System.in)
["Issue","Project","CustomField","User","Workflow","Action"].each{
println "${it}s: ${xml[it].size()}"
}
@christo
christo / gist:2478134
Created April 24, 2012 09:10
roy compile error
// Strong
console.log 40 + 2
// Won't compile:
// console.log "40" + 2
// Explicit
let f x: Number = x
console.log (f 100)
@christo
christo / randomline.pl
Created February 22, 2011 22:02
print a random line from a file
#!/usr/bin/perl
use warnings;
open FH, $ARGV[0] or die;
@lines = <FH>;
print @lines[int(rand(scalar @lines))] . "\n";
close FH;
#!/usr/bin/env groovy
import javax.sound.midi.*
def synth = MidiSystem.getSynthesizer()
synth.open()
def channel = synth.getChannels()[9]
// midi note for cowbell is 56
channel.noteOn(56, 96)
Thread.sleep(100)