Instantly share code, notes, and snippets.

View choix.py
weighted_choices = [('Red', 3), ('Blue', 2), ('Yellow', 1), ('Green', 4)]
population = [val for val, cnt in weighted_choices for i in range(cnt)]
random.choice(population)
View onename-check
Verifying that +slashdashpipe is my blockchain ID. https://onename.com/slashdashpipe
View FILLFORM.md

Installation

Add a bookmark to your browser with the :

  • Name : Fill form
  • URL : below javascript URL
View gist:b79e401e0d0b871d1a36
#build-pipeline-plugin-content {
background-color: none !important;
border-radius: 0;
}
#build-pipeline-plugin-content h1 {
display: none;
}
tbody.pipelineGroup {
View ExcelSheetReader.groovy
import java.io.BufferedWriter
import java.io.File
import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.FileWriter
import java.io.FilenameFilter
import java.io.IOException
import java.util.ArrayList
import org.apache.poi.openxml4j.exceptions.InvalidFormatException
import org.apache.poi.ss.usermodel.Cell
View README.asciidoc

What’s this?

If you are unlucky like me and you are constrained to work under windows for your groovy / grails / Java development, you certainly miss tools like GVM

This is a poor man’s windows dev environment switcher, based on symbolic links and made for Windows 7 or higher. And yes, it’s a one line command line :)

You are even poorer? you use XP :) Don’t panic, if you don’t have mklink on your windows, check alternatives here Symbolic links on windows

View TikaMetadataExtractor.groovy
/**
* Copyright 2013 Kai Sternad
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
View designer.html
<link href="../core-scaffold/core-scaffold.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../core-menu/core-menu.html" rel="import">
<link href="../core-item/core-item.html" rel="import">
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-menu/core-submenu.html" rel="import">
<link href="../paper-input/paper-input.html" rel="import">
<polymer-element name="my-element">
View original.clj
(take 25 (squares-of (integers)))