This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EActivity(R.layout.main) | |
public class FirstActivity extends Activity { | |
@ItemClick | |
public void myListItemClicked(MyItem clickedItem) { | |
Intent intent = new Intent(app, ClipsListActivity_.class); | |
MyBean bean = new MyBean(); | |
intent.putExtra("my_bean", new MyBean_(bean)); | |
startActivity(intent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyBean_ extends MyBean implements Parcelable { | |
private MyBean bean; | |
public MyBean_(MyBean bean) { | |
this.bean = bean; | |
} | |
public MyBean_(Parcel in) { | |
ClassLoader cl = this.getClass().getClassLoader(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//hide | |
//setup | |
[source,cypher] | |
---- | |
// League nodes | |
CREATE (fsgt:League{name:'FSGT 34'}) | |
CREATE (saison14:Season{name:'Season 2013-2014', year:'2014'}) | |
CREATE (saison13:Season{name:'Season 2012-2013', year:'2013'}) | |
CREATE (saison12:Season{name:'Season 2011-2012', year:'2012'}) | |
CREATE (fsgt-[:CURRENT_SEASON]->saison14),(saison14-[:PREVIOUS_SEASON]->saison13),(saison13-[:PREVIOUS_SEASON]->saison12) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More concise solution and without multiple split/join which are not useful | |
import 'dart:io'; | |
void main() { | |
String result = ''; | |
stdin.readLineSync().codeUnits.fold([], (r,i) { | |
List str = i.toRadixString(2).split(''); | |
return r ..addAll(new List.generate(7-str.length, (_) => '0')) ..addAll(str); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Codingame temperature challenge solution in Dart | |
// Eric Taix | |
import 'dart:io'; | |
void main() { | |
print(int.parse(stdin.readLineSync()) == 0 ? 0 : stdin.readLineSync().split(' ').map((s) => int.parse(s)) | |
.fold(10000,(r,i) => i.abs() == r.abs() ? (i > r ? i : r) : i.abs().compareTo(r.abs()) == -1 ? i : r)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
void main() { | |
int width = int.parse(stdin.readLineSync()); | |
int height = int.parse(stdin.readLineSync()); | |
List chars = stdin.readLineSync().split('').map((c) => c.toUpperCase()).map((c) => c.codeUnits[0]).toList(); | |
List dots = new List.generate(height, (_) => stdin.readLineSync().codeUnits.fold([], (d,i) => d..add(i))).fold([], (r,l) => r..addAll(l)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Codingame MIME types challenge solution in Dart | |
// Eric Taix | |
import 'dart:io'; | |
void main() { | |
int nbAsso = int.parse(stdin.readLineSync()); | |
int nbFile = int.parse(stdin.readLineSync()); | |
Map mimes = new List.generate(nbAsso, (_) => stdin.readLineSync()).map((s) => s.split(' ')).fold({}, (r, s) => r ..[s[0].toLowerCase()] = s[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Codingame Racing Horses challenge solution in Dart | |
// Eric Taix | |
import 'dart:io'; | |
void main() { | |
int min = 20000000; | |
List values = new List.generate(int.parse(stdin.readLineSync()), (_) => int.parse(stdin.readLineSync()))..insert(0, min)..sort((i,j) => i.compareTo(j)); | |
values.reduce((p,n) { | |
min = (p - n).abs() < min ? (p - n).abs() : min; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'dart:math'; | |
double toRadian(degree) => PI * degree / 180; | |
double parseDouble(string) => double.parse(string.replaceAll(',','.')); | |
void main() { | |
List<double> userLocation = new List<double>.generate(2, (index) => PI * double.parse(stdin.readLineSync().replaceAll(',','.')) / 180); | |
List defibrillators = new List | |
.generate(int.parse(stdin.readLineSync()), (index) => stdin.readLineSync().split(';')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Codingame Stock Exchange challenge solution in Dart | |
// Eric Taix | |
import 'dart:io'; | |
void main() { | |
stdin.readLineSync(); | |
int min = 0; | |
stdin.readLineSync().split(' ').map((s) => int.parse(s)).fold(null, (r, v) { | |
if (r == null) return v; |
OlderNewer