Skip to content

Instantly share code, notes, and snippets.

View aurerua's full-sized avatar

Aurelien Giraud aurerua

  • Leizpig, Germany
View GitHub Profile
@aurerua
aurerua / machine.js
Last active December 10, 2019 17:15
XState history
const myMachine = Machine({
id: "slide",
initial: "notFlying",
on: {
FLY: "flying"
},
states: {
flying: {
on: {
LAND: "notFlying.hist"
@aurerua
aurerua / machine.js
Last active December 10, 2019 17:13
XState history + activities
const myMachine = Machine({
initial: 'slide',
states: {
slide: {
id: 'slide',
initial: 'ground',
states: {
ground: {
on: {
CLIMB_UP: 'ladder'
@aurerua
aurerua / machine.js
Last active December 10, 2019 17:11
XState parallel states
const myMachine = Machine({
id: 'slide',
initial: 'ground',
states: {
ground: {
on: {
CLIMB_UP: 'ladder'
}
},
ladder: {
@aurerua
aurerua / machine.js
Last active December 10, 2019 17:17
XState simple machine
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@aurerua
aurerua / chef-fetch-run.txt
Last active December 4, 2016 14:02
Graphic showing what chef-fetch-run.sh does
+------------------------+
| | +------------------------+
| +--------------------+ | | |
| | | | | +--------------------+ |
| | laptop-config.rb | | 1. Fetch | | | |
| | +------------<---------+ chef-fetch-run.sh | |
| +------------------|-+ | | | | |
| | | | +--------------------+ |
| | | | |
| +------------>--------> 2. Run Chef recipe |
@aurerua
aurerua / laptop-config.rb
Created December 4, 2016 12:20
A Chef recipe to create a user and install a few packages
# update the apt cache
apt_update 'Update the apt cache daily' do
frequency 86_400
action :periodic
end
# Make sure some packages are present
package ['ruby-shadow', 'whois', 'vim', 'git', 'geogebra', 'vlc', 'browser-plugin-vlc', 'libavcodec-extra', 'chromium-browser', 'chromium-browser-l10n', 'chromium-codecs-ffmpeg']
# Make sure there is a user called Stephen
@aurerua
aurerua / server.js
Created March 27, 2016 20:56
Goals tracker — Express, NeDB and REST API - GET one
// GET a goal.
// (Accessed at GET http://localhost:8080/goals/goal_id)
app.get('/goals/:id', function(req, res) {
var goal_id = req.params.id;
db.findOne({
_id: goal_id
}, {}, function(err, goal) {
if (err) res.send(err);
res.json(goal);
});
@aurerua
aurerua / 2x2 Grid with expandable cells.markdown
Created January 10, 2016 22:27
2x2 Grid with expandable cells
@aurerua
aurerua / build-bootstrap-carousel.js.markdown
Created November 22, 2015 18:30
build-bootstrap-carousel.js