Skip to content

Instantly share code, notes, and snippets.

View eric-taix's full-sized avatar
🚀

Eric Taix eric-taix

🚀
View GitHub Profile
@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);
}
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();
//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)
@eric-taix
eric-taix / Chuck Norris
Last active August 29, 2015 13:56
Solution of CodinGame January in Dart
// 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);
})
@eric-taix
eric-taix / cg-temperature
Created February 14, 2014 10:31
Codingame temperature challenge solution in Dart
// 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));
}
@eric-taix
eric-taix / cg-ascii-art
Created February 14, 2014 12:05
Codingame ASCII Art challenge solution in Dart
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));
@eric-taix
eric-taix / cg-mime-types
Created February 14, 2014 12:40
Codingame MIME types challenge solution in Dart
// 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]);
@eric-taix
eric-taix / gc-racing-horses
Created February 14, 2014 13:39
Codingame Racing Horses challenge solution in Dart
// 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;
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(';'))
@eric-taix
eric-taix / gc-stock-exchange
Created February 14, 2014 17:35
Codingame Stock Exchange challenge solution in Dart
// 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;