Skip to content

Instantly share code, notes, and snippets.

View sachaarbonel's full-sized avatar
👨‍💻
Uncovering bugs

Sacha Arbonel sachaarbonel

👨‍💻
Uncovering bugs
View GitHub Profile
@sachaarbonel
sachaarbonel / notes_on_testing.md
Created January 9, 2019 12:48 — forked from ikusalic/notes_on_testing.md
Exploration: how to do unit testing

Testing notes

Uncle Bob: Test First

Source: http://blog.8thlight.com/uncle-bob/2013/09/23/Test-first.html

  • tests are specs for the system and are more important than the system itself
  • (Tests should be) short, well factored, and well named. They ought to read like specifications; because they are specifications
  • (Goal:) trust your test suite to the extent that, if it passes, you know you
@sachaarbonel
sachaarbonel / strategy.go
Created January 15, 2019 07:27 — forked from vaskoz/strategy.go
Golang strategy pattern
package main
import "fmt"
type Strategy func(string, string) string
type Strategic interface {
SetStrategy(Strategy)
Result() string
}
@sachaarbonel
sachaarbonel / dart.md
Created January 31, 2019 07:12 — forked from paulmillr/dart.md
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <[email protected]>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: [email protected]
@sachaarbonel
sachaarbonel / builder.go
Created January 31, 2019 12:41 — forked from vaskoz/builder.go
Golang Builder pattern
package main
import "strconv"
import "fmt"
type Color string
type Make string
type Model string
const (
// BLOC
class ErrorBloc extends Bloc<ErrorBlocEvent, ErrorBlocState> {
@override
Stream<ClaimState> mapEventToState(ErrorBlocState currentState, ErrorBlocEvent event) async* {
if (event is SomeEvent) {
yield Processing();
final result = await _doSomething();
if(result.success) {
yield Success();
@sachaarbonel
sachaarbonel / netlify.sh
Created February 19, 2019 06:56 — forked from lightdiscord/netlify.sh
Rust and wasm and netlify
#!/usr/bin/env bash
set -e
cweb_version=0.6.16
cweb=https://github.com/koute/cargo-web/releases/download/$cweb_version/cargo-web-x86_64-unknown-linux-gnu.gz
curl -Lo cargo-web.gz $cweb
gunzip cargo-web.gz
chmod u+x cargo-web
@sachaarbonel
sachaarbonel / gist:5104146cab136dba43c3b0a0fe7cd925
Created March 2, 2019 12:23 — forked from sartak/a.md
Anki 2 annotated schema
-- see https://github.com/ankidroid/Anki-Android/wiki/Database-Structure for a more maintained version of this
-- cards are what you review. easy!
CREATE TABLE cards (
id integer primary key,
-- the epoch milliseconds of when the card was created
nid integer not null,
-- notes.id
did integer not null,
-- deck id (available in col table)
@sachaarbonel
sachaarbonel / inspect.go
Created March 12, 2019 17:46 — forked from FingerLiu/inspect.go
inspect json and generate graphql schema
package main
/*
parse json, extract type in json and save to graphql.schema
*/
import (
"io/ioutil"
"encoding/json"
"reflect"
"fmt"
@sachaarbonel
sachaarbonel / README.md
Created March 20, 2019 12:11 — forked from sma/README.md
This is an ad-hoc Java-to-Dart translator written in three days. This is version 2 which some bug fixes.

Java to Dart

This is an ad-hoc Java-to-Dart translator originally written on two (admittedly long) evenings.

See http://sma.github.io/stuff/java2dartweb/java2dartweb.html for a demo.

Note: It doesn't support the complete Java grammar specification and cannot translate everything. It only translates syntax and does not attempt to translate Java library classes and methods to Dart equivalents (with the exception of String.charAt and StringBuffer.append). You will have to make changes to the resulting Dart code. It does not support anonymous inner classes.

However, I was able to successfully convert a 7000+ line command line application with only minimal fixes in 30 minutes.

@sachaarbonel
sachaarbonel / center.dart
Created March 23, 2019 14:28 — forked from ggirou/center.dart
Center mass of SVG path elements
import 'dart:convert';
import 'dart:html';
import 'dart:math';
import 'dart:svg' as svg;
main() {
HttpRequest.getString('svg-datas.json').then(JSON.decode).then(calculateGravity);
}
calculateGravity(Map<String, Map> paths) {