A short script to count Checkstyle violation types.
$ ruby xml.rb /path/to/checkstyle-results.xml
| import android.support.annotation.IntDef; | |
| import java.lang.annotation.Retention; | |
| import static android.view.View.GONE; | |
| import static android.view.View.INVISIBLE; | |
| import static android.view.View.VISIBLE; | |
| import static java.lang.annotation.RetentionPolicy.CLASS; | |
| @Retention(CLASS) |
An updated version of https://gist.github.com/jczaplew/6453048 or http://bl.ocks.org/jczaplew/6453048 using the logic from this example http://mbostock.github.io/d3/talk/20111018/azimuthal.html
| float total = 0; | |
| void setup() { | |
| size(400, 400); | |
| } | |
| void draw() { | |
| background(50); | |
| fill(total > 0 ? color(0, 255, 0) : color(255, 0, 0)); | |
| ellipse(width/2, height/2, total, total); |
| class Asteroid { | |
| PVector location; | |
| PVector velocity; | |
| PVector acceleration; | |
| float mass; | |
| String tweet; | |
| float x, y, w, h; | |
| boolean hit; | |
| boolean dead; | |
| float hitTime, textTime; |
| /* | |
| Serial Event example | |
| When new serial data arrives, this sketch adds it to a String. | |
| When a newline is received, the loop prints the string and | |
| clears it. | |
| A good test for this is to try it with a GPS receiver | |
| that sends out NMEA 0183 sentences. | |
| #!/usr/bin/python | |
| # get a list of androgynous names and write it to a .txt file | |
| # requires BeautifulSoup library | |
| # imports | |
| from bs4 import BeautifulSoup | |
| import urllib2 | |
| import sys | |
| import os |
| const int numLeds = 4; | |
| const int pins[] = { | |
| 2, 3, 4, 5}; | |
| long t_random[numLeds]; | |
| long t_reset[numLeds]; | |
| long top_range = 2000; | |
| long bottom_range = 100; | |
| int previous_led_state[numLeds]; | |
| int led_state[numLeds]; |
| String barcode = ""; | |
| void setup() {} | |
| void draw() {} | |
| void keyPressed() { | |
| barcode+=key; | |
| if (key == '\n') { // we've reached the end of the barcode | |
| println(barcode); |
| // check position of rocker function | |
| // t = top pin connection to switch | |
| // b = bottom pin connection to switch | |
| int checkRocker(int t, int b) { | |
| int top = digitalRead(t); | |
| int bottom = digitalRead(b); | |
| if (top == LOW && bottom == HIGH) return 0; // top position | |
| else if (top == HIGH && bottom == HIGH) return 1; // middle position | |
| else if (top == HIGH && bottom == LOW) return 2; // low position | |
| } |