Skip to content

Instantly share code, notes, and snippets.

View Dispader's full-sized avatar
:electron:
Present Company Excluded, LLC

Jake Gage Dispader

:electron:
Present Company Excluded, LLC
View GitHub Profile
@Dispader
Dispader / httpbuilder-ng.groovy
Created April 7, 2017 01:50
Self-contained Groovy Console example for using httpbuilder-ng.
@Grab(group='io.github.http-builder-ng', module='http-builder-ng-apache', version='0.15.0')
public class UsedToExposeAnnotationToComplier {}
println 'ok computer'
import groovyx.net.http.HttpBuilder
def httpBin = HttpBuilder.configure {
request.uri = 'http://httpbin.org/'
}
@Dispader
Dispader / calendar_notes.groovysh
Last active March 31, 2017 22:35
Groovy Shell log for creating iCal events.
groovy:000> :load https://git.io/v2N1I
groovy:000> :register GrabCommand
groovy:000> :grab 'commons-codec:commons-codec'
groovy:000> :grab 'org.mnode.ical4j:ical4j-extensions:1.0.0'
groovy:000> import net.fortuna.ical4j.extensions.ContentBuilder
groovy:000> builder = new ContentBuilder()
@Dispader
Dispader / build-announcements.gradle
Last active March 31, 2017 16:26
Put this in `~/.gradle/init.d/` to get build announcements for all your projects.
initscript {
repositories { maven { url 'https://plugins.gradle.org/m2' } }
}
rootProject {
apply plugin: org.gradle.api.plugins.announce.BuildAnnouncementsPlugin
}
@Dispader
Dispader / ConfigSpec.groovy
Created December 28, 2016 19:33
Configuration test specification, including XML configuration object test.
package edu.umn.pssa.ibmonitorservice
import org.apache.commons.configuration2.XMLConfiguration
import org.apache.commons.configuration2.builder.fluent.Configurations
import spock.lang.Specification
class ConfigSpec extends Specification {
Config config = new Config('configs.xml')
@Dispader
Dispader / greed.rb
Last active August 3, 2016 17:26
one proposed solution to the greed.rb problem, proposed in [Ian Whitney's Ruby Brown Bag](https://github.com/IanWhitney/ruby_brownbag}, for comment — please, please comment: I'm a Ruby tyro, and could use the help. (And many thanks to Ian for his great session, and Chris Crosby-Schmidt for inspiring the approach!)
class Greed
def self.score(dice)
# initialize a score
score = 0
# create a hash of the roll (face values) and the number of times rolled
rolls = dice.inject(Hash.new(0)) {|hash, roll| hash[roll] += 1; hash }
@Dispader
Dispader / gist:ac4bf409d446d59bae92242f4236c160
Created July 26, 2016 16:11 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@Dispader
Dispader / norris.groovy
Last active June 30, 2016 02:57
Chuck Norris database query — pretty edition
:load https://git.io/v2N1I
:register GrabCommand
:grab 'org.apache.commons:commons-lang3:3.4'
import org.apache.commons.lang3.StringEscapeUtils
slurper = new groovy.json.JsonSlurper()
println "\n${StringEscapeUtils.unescapeHtml4(slurper.parse( new URL('http://api.icndb.com/jokes/random') ).value.joke)}\n"
BASE = 'http://api.icndb.com/jokes/random?'
new JsonSlurper().parseText("${BASE}qs".toURL().text).value.joke
@Dispader
Dispader / minimal.sh
Last active June 11, 2016 20:19
minimal chefdk startup — running notes
brew cask install chefdk
eval "$(chef shell-init bash)" && alias git=/usr/local/bin/git
@Dispader
Dispader / grgit.groovy
Last active May 11, 2016 23:56
interactive Groovysh session exploring GrGit
groovy:000> :load https://git.io/v2N1I
===> true
groovy:000> :register GrabCommand
===> true
groovy:000> :grab 'org.slf4j:slf4j-simple:1.7.21'
groovy:000> :grab 'org.ajoberstar:grgit:1.7.0'
groovy:000> import org.ajoberstar.grgit.Grgit
===> org.ajoberstar.grgit.Grgit
groovy:000> grgit = Grgit.open()
===> org.ajoberstar.grgit.Grgit@12f3afb5