Skip to content

Instantly share code, notes, and snippets.

View wtf.test.dart
import 'package:/unittest/unittest.dart';
void main() {
group ("WTF? Dart", (){
test("doesn't recognize that a function is equals to itself...", () {
expect(myFunction != myFunction , isTrue);
});
});
}
@mbreton
mbreton / minesweeper.dart
Created Feb 12, 2013
Minesweeper implementation in Dart
View minesweeper.dart
library minesweeper;
class Minesweeper {
int width;
int height;
List<String> _lines;
Minesweeper (){
width = 0;
height = 0;
@mbreton
mbreton / gamepadSupport.js
Created May 24, 2013
This gist is a fast and simple "getting started" to try gamepad api under chrome and firefox.
View gamepadSupport.js
var gamepadSupport = {
ticking: false,
gamepads: [],
prevRawGamepadTypes: [],
prevTimestamps: [],
init: function() {
var gamepadSupportAvailable = !!navigator.webkitGetGamepads
|| !!navigator.webkitGamepads
|| (navigator.userAgent.indexOf('Firefox/') != -1);
@mbreton
mbreton / "sudo npm install" output
Created Jun 16, 2013
Output of a "sudo npm install" into cloud9 directory under Mac OS X 10.7.5
View "sudo npm install" output
pm http GET https://registry.npmjs.org/simple-template/0.0.1
npm http GET https://registry.npmjs.org/connect/1.8.7
npm http GET https://registry.npmjs.org/http-error/0.0.1
npm http GET https://registry.npmjs.org/amd-loader/0.0.4
npm http GET https://registry.npmjs.org/async/0.1.21
npm http GET https://registry.npmjs.org/dryice/0.4.10
npm http GET https://registry.npmjs.org/optimist/0.3.4
npm http GET https://registry.npmjs.org/architect/0.1.4
npm http GET https://registry.npmjs.org/netutil/0.0.1
npm http GET https://registry.npmjs.org/connect-architect/0.0.6
@mbreton
mbreton / roundDecimal.js
Created Mar 28, 2016
Round a decimal number with the given precision
View roundDecimal.js
function roundDecimal(number, precision) {
precision = precision || 2;
const tmp = Math.pow(10, precision);
return Math.trunc(Math.round(number * tmp) / tmp, precision);
}
View toto.ts
import { Component, Input } from '@angular/core';
import { User } from '../../shared';
@Component({
selector: 'jsr-user-form',
templateUrl: './user-form.component.html',
styleUrls: ['./user-form.component.scss']
})
export class UserFormComponent {
@mbreton
mbreton / Unix-shell-survival-kit.md
Last active Apr 21, 2017
Unix Shell Survival Kit
View Unix-shell-survival-kit.md

Unix Shell Survial Kit

  • Masteriser Vim ou Emacs
  • Savoir faire du ssh : -vvv pour débugger les problèmes, -i pour utiliser une clé publique
  • ctrl + r : historique intérractif
  • ctrl + w : Efface des blocs de lettre
  • ctrl + e : Va à la fin de la commande
  • ctrl + a : Va à début de la commande
  • ctrl + l : Efface les lignes du terminal
@mbreton
mbreton / foo.service.spec.ts
Last active Mar 9, 2018
Angular TestBed is too long
View foo.service.spec.ts
import { FooService } from './foo.service';
import { TestBed } from '@angular/core/testing';
function itLotOfTime(description: string, itBody: () => void) {
for (let i = 0; i < 1000; i++) {
it(description, itBody);
}
}
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions