Skip to content

Instantly share code, notes, and snippets.

View rlespinasse's full-sized avatar

Romain Lespinasse rlespinasse

View GitHub Profile
@rlespinasse
rlespinasse / MagicalLand.java
Created February 19, 2013 23:29
Unicorn love Math
public class MagicalLand {
public static void main(String[] args) {
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
System.out.println("UNICORN #1: PAT THIS UNICORN ONCE");
}
}
for (int i = 0; i < (Math.random() * 500) + 2; i++) {
if (Unicorn.pat()) {
@rlespinasse
rlespinasse / GoogleAnalytics.java
Last active August 29, 2015 14:06
API design for Dandelion-GUA
GoogleAnalytics.on(request)
// Get (or Create) Default Tracker (with tracking ID from configuration)
.defaultTracker().goBack()
// Get (or Create) Default Tracker
.defaultTracker("UA-XXXX-Y")
.set(GeneralField.anonymizeIp, "true")
.set(SessionField.sessionControl, "sessionControl").goBack()
// Get (or Create) Another Tracker
.tracker("UA-XXXX-Z", "name-Z")
// Access to "create" section
@rlespinasse
rlespinasse / keybase.md
Created December 5, 2014 08:57
Keybase proof

Keybase proof

I hereby claim:

  • I am rlespinasse on github.
  • I am rlespinasse (https://keybase.io/rlespinasse) on keybase.
  • I have a public key whose fingerprint is 871E 61C6 7483 438C B38F C050 9753 B4DB 701F 1EE9

To claim this, I am signing this object:

@rlespinasse
rlespinasse / Makefile
Created May 21, 2015 20:45
kata roman numerals in Go
all: testAndCover
testAndCover:
@go test -coverprofile=cover.out .
@go tool cover -html=cover.out
@rlespinasse
rlespinasse / substring.golo
Last active August 29, 2015 14:26
substring.golo
module substring
augment java.lang.String {
function substring = |this, separator| {
return this: substring(0, this: indexOf(separator) + separator: length())
}
}
function main = |args| {
println("abcdefgh": substring(0, 5)) // abcde
@rlespinasse
rlespinasse / .gitignore
Created January 4, 2016 15:09
Jenkins configuration backup
# untrack all files and folders
/*
# Except the jenkins configuration
!/config.xml
# Except the jenkins plugin configurations
!/hudson*.xml
# Except this file
@rlespinasse
rlespinasse / homebrew_golo.md
Last active March 2, 2016 11:28
HOW-TO: Update the verions of golo-lang on Homebrew

Update the versions of golo-lang on Homebrew

Retrieve information

  • Get the url of the distribution archive for the new release
  • Get the sha256 of this archive (like shasum -a 256 {archive})

Propose the pull request for the release

@rlespinasse
rlespinasse / chocolatey_golo.md
Last active January 14, 2016 22:32
HOW-TO: Update the verions of golo-lang on Chocolatey

Update the versions of golo-lang on Chocolatey

Retrieve information

  • Get the url of the distribution archive for the new release
  • Get the url of the blog post about the new release

Propose the pull request for the release

@rlespinasse
rlespinasse / Jenkinsfile.groovy
Last active September 26, 2019 11:36
Jenkinsfile to tag the sources used by current build
node {
repositoryAccess = 'https://'
repositoryAccessSeparator = '/'
echo "repository host: ${repositoryHost}" // github.com
echo "repository path: ${repositoryPath}" // <user>/<repository>.git
echo "repository jenkins credentials id: ${credentialsId}" // jenkins credentials for the jenkins git account who have commit access
echo "repository branch: ${branch}" // master or another branch
echo "repository commiter username: ${repositoryCommiterUsername}" // Jenkins account email
echo "repository commiter name: ${repositoryCommiterEmail}" // Jenkins
#!/usr/bin/env bash
set -e
listSwarms() {
ls ~/.horde
}
initSwarm() {
mkdir -p ~/.horde/$1