Skip to content

Instantly share code, notes, and snippets.

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 / machine.js
Created July 2, 2020 16:38
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@mbreton
mbreton / foo.service.spec.ts
Last active March 9, 2018 18:20
Angular TestBed is too long
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);
}
}
@mbreton
mbreton / Unix-shell-survival-kit.md
Last active April 21, 2017 09:56
Unix Shell Survival Kit

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 / roundDecimal.js
Created March 28, 2016 23:05
Round a decimal number with the given precision
function roundDecimal(number, precision) {
precision = precision || 2;
const tmp = Math.pow(10, precision);
return Math.trunc(Math.round(number * tmp) / tmp, precision);
}
@mbreton
mbreton / "sudo npm install" output
Created June 16, 2013 19:54
Output of a "sudo npm install" into cloud9 directory under Mac OS X 10.7.5
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 / gamepadSupport.js
Created May 24, 2013 21:50
This gist is a fast and simple "getting started" to try gamepad api under chrome and firefox.
var gamepadSupport = {
ticking: false,
gamepads: [],
prevRawGamepadTypes: [],
prevTimestamps: [],
init: function() {
var gamepadSupportAvailable = !!navigator.webkitGetGamepads
|| !!navigator.webkitGamepads
|| (navigator.userAgent.indexOf('Firefox/') != -1);
@mbreton
mbreton / minesweeper.dart
Created February 12, 2013 15:04
Minesweeper implementation in Dart
library minesweeper;
class Minesweeper {
int width;
int height;
List<String> _lines;
Minesweeper (){
width = 0;
height = 0;
@mbreton
mbreton / wtf.test.dart
Created November 17, 2012 19:45
WTF? Dart tests
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);
});
});
}