Skip to content

Instantly share code, notes, and snippets.

if item.name != 'Aged Brie' && item.name != 'Backstage passes to a TAFKAL80ETC concert'
if item.quality > 0
if item.name != 'Sulfuras, Hand of Ragnaros'
item.quality -= 1
end
end
else
if item.quality < 50
item.quality += 1
if item.name == 'Backstage passes to a TAFKAL80ETC concert'
public ArrayList eseguiAnalisi() {
ArrayList listaSegnalazioni = new ArrayList();
List domande = null;
Domanda domanda = null;
List risposte = null;
DAOReques req = new DAOReques();
DAOArea ar = new DAOArea();
ar.setIdQuestionario(getIdQuestionario());

Keybase proof

I hereby claim:

  • I am philipschwarz on github.
  • I am philip_schwarz (https://keybase.io/philip_schwarz) on keybase.
  • I have a public key whose fingerprint is B0D0 6715 3B2D 4C62 D0DE CC12 97DC 056B 8C5B 068B

To claim this, I am signing this object:

@philipschwarz
philipschwarz / print-diamond.clj
Created December 3, 2014 00:20
First stab at Clojure print-diamond
(defn print-diamond [letter]
(let [alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
position-of (fn [letter] (inc (- (int letter) (int \A))))
number-of-letters (position-of letter)
dashes (fn [n] (repeat n \-))
fixed-text-for (fn [letter] (concat (dashes (dec (position-of letter))) (list letter)))
template (map fixed-text-for (take number-of-letters alphabet))
pad-with-trailing-dashes (fn [index line] (concat line (dashes (dec (- number-of-letters index)))))
top-right-quadrant (map-indexed pad-with-trailing-dashes template)
top-left-quadrant (map reverse (map rest (take number-of-letters top-right-quadrant)))
@philipschwarz
philipschwarz / Java8SyntacticSugar.java
Last active August 29, 2015 14:13
tasting the lambda syntactic sugar that the Java 8 Compiler lets you write in place of an instance of a required functional interface
IntStream.of(1, 2, 3).forEach( new IntConsumer() { public void accept(int value) { System.out.println(value); } } );
IntStream.of(1, 2, 3).forEach( new IntConsumer() { public void accept(int n) { System.out.println(n); } } );
IntStream.of(1, 2, 3).forEach( (int n) -> { System.out.println(n); } );
IntStream.of(1, 2, 3).forEach( (int n) -> System.out.println(n) );
IntStream.of(1, 2, 3).forEach( n -> System.out.println(n) );
IntStream.of(1, 2, 3).forEach( System.out::println );
(defmulti area
"Calculate the area of a shape"
:type)
(defmethod area :rectangle [shape]
(* (:length shape) (:width shape)))
(defmethod area :circle [shape]
(* (. Math PI) (:radius shape) (:radius shape)))
package test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.Collections;
import java.util.Iterator;
@philipschwarz
philipschwarz / gist:1059890
Created July 2, 2011 09:23
Before applying "Replace Temp With Query" to totalAmount
public String statement()
{
double totalAmount = 0;
int frequentRenterPoints = 0;
Enumeration<Rental> allRentals = rentals.elements();
String result = "Rental record for " + getName() + "\n";
while (allRentals.hasMoreElements())
{
Rental each = (Rental) allRentals.nextElement();
frequentRenterPoints += each.getFrequentRenterPoints();
@philipschwarz
philipschwarz / gist:1059894
Created July 2, 2011 09:31
After applying "Replace Temp with Query" to totalAmount
public String statement()
{
int frequentRenterPoints = 0;
Enumeration<Rental> allRentals = rentals.elements();
String result = "Rental record for " + getName() + "\n";
while (allRentals.hasMoreElements())
{
Rental each = (Rental) allRentals.nextElement();
frequentRenterPoints += each.getFrequentRenterPoints();
@philipschwarz
philipschwarz / gist:1059899
Created July 2, 2011 09:35
After applying "Replace Temp with Query" to frequentRenterPoints
public String statement()
{
Enumeration<Rental> allRentals = rentals.elements();
String result = "Rental record for " + getName() + "\n";
while (allRentals.hasMoreElements())
{
Rental each = (Rental) allRentals.nextElement();
// show figures for this rental
result += "\t" + each.getMovie().getTitle() + "\t" + String.valueOf(each.getCharge()) + "\n";