Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
follows you

Chris Mountford christo

💭
follows you
View GitHub Profile
View p5-circles.js
var scanx = 0;
var amp;
var cy;
var cx;
function setup() {
createCanvas(800, 800);
background(100);
reset();
}
View beginworld.css
@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;
View keybase.md

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 Dec 16, 2015
Example groovy code ignoring exceptions.
View ignoringExample.groovy
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 Apr 1, 2020
Some compact Groovy syntax to ignore specific exceptions.
View ignoring.groovy
// 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 Dec 17, 2012
jira xml scaler reads a JIRA XML backup and gives you basic stats on the number of key domain objects in the backup.
View jxs.groovy
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 Apr 24, 2012
roy compile error
View gist:2478134
// 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 Feb 22, 2011
print a random line from a file
View randomline.pl
#!/usr/bin/perl
use warnings;
open FH, $ARGV[0] or die;
@lines = <FH>;
print @lines[int(rand(scalar @lines))] . "\n";
close FH;
View cowbell.groovy
#!/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)