Skip to content

Instantly share code, notes, and snippets.

View Synesso's full-sized avatar

Jem Mawson Synesso

View GitHub Profile

Keybase proof

I hereby claim:

  • I am synesso on github.
  • I am jem (https://keybase.io/jem) on keybase.
  • I have a public key whose fingerprint is 2AFD 4BB7 EF77 7F5C 5EF5 383E 3310 1ABB 05C8 620A

To claim this, I am signing this object:

void rotate() {
final MainActivity activity = getActivity();
activity.setRequestedOrientation(
activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
: ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
@Synesso
Synesso / Async.java
Created January 18, 2015 06:56
Simplification of Android's AsyncTask using functionaljava
import android.app.Activity;
import android.os.AsyncTask;
import fj.F;
import fj.function.Effect1;
public class Async<A, B> extends AsyncTask<A, Void, B> {
private final F<A, B> f;
private Effect1<B> e = new Effect1<B>() {
{"paymentInstrumentTypes":[{"paymentInstrumentTypeId":3,"description":"American Express Credit Card","name":"Amex"},{"paymentInstrumentTypeId":6,"description":"Internet Banking","name":"POLi"},{"paymentInstrumentTypeId":5,"description":"Bank Account","name":"BankAccount"},{"paymentInstrumentTypeId":2,"description":"MasterCard Credit Card","name":"MasterCard"},{"paymentInstrumentTypeId":1,"description":"Visa Credit Card","name":"Visa"},{"paymentInstrumentTypeId":4,"description":"Diners Credit Card","name":"Diners"}]}
package com.github.synesso.cheryl
object Main extends App {
val possibleAnswers = Set(
May(15), May(16), May(19),
Jun(17), Jun(18),
Jul(14), Jul(16),
Aug(14), Aug(15), Aug(17)
)
package au.com.loftinspace;
import com.googlecode.instinct.marker.annotate.Subject;
import com.googlecode.instinct.marker.annotate.Mock;
import com.googlecode.instinct.marker.annotate.Specification;
import com.googlecode.instinct.marker.annotate.BeforeSpecification;
import static com.googlecode.instinct.expect.Expect.expect;
import com.googlecode.instinct.integrate.junit4.InstinctRunner;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
package au.com.loftinspace;
import com.googlecode.instinct.marker.annotate.Subject;
import com.googlecode.instinct.marker.annotate.Mock;
import com.googlecode.instinct.marker.annotate.Specification;
import com.googlecode.instinct.marker.annotate.BeforeSpecification;
import static com.googlecode.instinct.expect.Expect.expect;
import com.googlecode.instinct.integrate.junit4.InstinctRunner;
import java.util.List;
jem@fawkes:~/projects/specs-presentation$ scala -cp lib_managed/default/specs-1.4.4.jar:lib_managed/default/mockito-core-1.7.jar:lib_managed/default/h-core-1.1.jar:lib_managed/default/junit-4.4.jar
Welcome to Scala version 2.7.3.final (Java HotSpot(TM) Client VM, Java 1.6.0_13).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import org.specs._
import org.specs._
scala> import org.specs.mock._
import org.specs.mock._
Author : Clare Marie Peden (IP: 90.212.228.97 , 5ad4e461.bb.sky.com)
E-mail : clare.marie@hotmail.com
URL :
Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=90.212.228.97
Comment:
My dad bought me a religious magnetic figurine of the Virgin Mary. When I said to him it looked like a chess-piece, he beat me up and I called the police. I was 23 at the time. I didn't have any contact with him for 4 years after that. I am now 35. Can you please send me a picture of a religious Virgin Mary chess-piece so I can prove to him that I am right? He is so old-fashioned, he refuses to believe that anything religious could possibly have anything to do with chess. He thinks chess-pieces are based on evil and not Christianity.
Thank you.
(for (i <- 100 to 999; j<- i to 999; val prod = i*j; val prodStr = prod.toString; if prodStr.equals(prodStr.reverse.toString)) yield (i, j, prodStr)).foldLeft((1,1,"1")){ (max, next) => if (max._3.toInt > next._3.toInt) max else next }