Skip to content

Instantly share code, notes, and snippets.

@jeanlaurent
jeanlaurent / literate.litcoffee
Created February 28, 2013 13:12
A first example of literate coffeescript

#Literate CoffeeScript

This is a first example of writing a markdown file with literate coffeescript

Literate coffeescript, let you mix Markdown syntax with plain coffeescript.

class Person
	constructor: (@name) ->
		@age = 0
pms = ->[
'rasperrypi',
'windows embedded',
'46"',
'hubot',
'node.js',
'arp-scan',
'airplay',
'studio',
'visuwall',
@jeanlaurent
jeanlaurent / gist:5474503
Created April 27, 2013 20:08
Jekyll with complex data in the YAML front matter parsed by liquid template
---
products:
- {prix: 17, name: mon-cahier-3, description: "<a href='mailto:someone@morlhon.net?subject=test%20test'>jl</a>"}
- {prix: 18, name: mon-cahier-7, description: "<h1>TEST</h1>"}
---
<html>
<head>
<title>Jekyll test</title>
</head>
<body>
@jeanlaurent
jeanlaurent / whoisthere.sh
Last active December 16, 2015 18:29
who is there ?
#!/bin/sh
ip=`ifconfig | awk '/inet /' | awk '!/127.0./' | awk '!/172./' | awk '{ print $2 }'`
subnet=`echo $ip | cut -d '.' -f1-3`
sudo arp-scan -l | grep "$subnet" | awk '{print $2}' | tr '[:lower:]' '[:upper:]'
# sudo nmap -sP $subnet.1-254 | grep MAC | awk '{print $3}'
should = require('chai').should()
class MineSweeper
constructor: (gridAsString) ->
return if !gridAsString?
grid = gridAsString.split '\n'
firstLine = grid[0].split ' '
@width = +firstLine[0]
@height = +firstLine[1]
@grid = grid[1..]

Mois du JS

~ 10 minutes / question

Introduction

  • Quel framework allez vous plus particulièrement défendre ?
  • Pourquoi vous défendez ce framework, et quel est votre experience avec celui ci.
  • Pour finir, dites moi votre experience avec les autres frameworks.
@jeanlaurent
jeanlaurent / watch.coffee
Created July 9, 2013 09:58
Run some script when file changes
#!/usr/bin/env coffee
fs = require('fs')
exec = require('child_process').exec
unless process.argv[3]?
console.log """
missing parameters :
watch.coffee directory_to_watch script_to_exec_on_file_change
"""
process.exit -1
public class Omnibus {
String commands[] = {
"OPEN","CLOSE","UP",
"OPEN","CLOSE","UP",
"OPEN","CLOSE","UP",
"OPEN","CLOSE","UP",
"OPEN","CLOSE","UP",
"OPEN","CLOSE","DOWN",
"OPEN","CLOSE","DOWN",
class Omnibus
constructor: ->
@commands = []
reset: ->
@commands = []
call: ->
next: ->
@jeanlaurent
jeanlaurent / tapei.conf
Last active December 27, 2015 13:59
Node.js npm server upstart conf
# tapei.conf
description "This is a *very* simple elevator implementation serving as a starting point for code-story S03E01"
start on startup
stop on shutdown
script
echo $$ > /var/run/tapei.pid