Skip to content

Instantly share code, notes, and snippets.

Version 1 :
function readContent(callback) {
fs.readFile("./tmp/tmp.log", function (err, content) {
if (err) return callback(err);
callback(null, content);
})
}
var fileContent = readContent(function (err, content) {
console.log(content);
Version 1 :
function readContent(callback) {
fs.readFile("./tmp/tmp.log", function (err, content) {
if (err) return callback(err);
callback(null, content);
})
}
var fileContent = readContent(function (err, content) {
console.log(content);
function readContent(callback) {
fs.readFile("./tmp/tmp.log", function (err, content) {
if (err) return callback(err);
callback(null, content);
})
}
exports.index = function(req, res){
readContent(function(err, fileContent){
res.render('index', {
@jblanche
jblanche / eventable.js
Created June 27, 2012 14:51 — forked from anonymous/eventable.js
eventable.js
var Eventable =
{
addEventListener: function(type, listener)
{
if (this.eventMap == null)
this.eventMap = {};
var list = this.eventMap[type];
if (list == null)
{
list = [];
@jblanche
jblanche / eventable.js
Created June 27, 2012 14:47 — forked from anonymous/eventable.js
eventable.js
var Eventable =
{
addEventListener: function(type, listener)
{
if (this.eventMap == null)
this.eventMap = {};
var list = this.eventMap[type];
if (list == null)
{
list = [];
@jblanche
jblanche / typeParams.rb
Created November 22, 2011 23:45 — forked from devboy/typeParams.as
This is not a language flamewar, Haxe really do looks great and one should use the language he feels the more comfortable with. But I wanted to show how Ruby Duck Typing can handle this kind of situations.
# Ruby is using Duck Typing, rather than checking types, Ruby checks if an object can or cannot respond to a method.
# Here is a "port" of the Haxe example in Ruby.
# Ruby is not a compiled language, so that the "easiest" syntax comes with some shortcoming,
# those errors can only be detected at runtime, your favorite IDE won't warn you before :)
ints = [1, 2, 3]
strings = ["a", "bb", "ccc"]
def biggerThan1(x)
x > 1
@jblanche
jblanche / README.md
Created November 5, 2011 13:43 — forked from mbostock/.block
D3 Show Reel

The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:

  • lines
  • horizons
  • areas
  • stacked areas
  • streamgraph
  • overlapping areas
  • grouped bars
  • stacked bars
@jblanche
jblanche / HelloDartTest.dart
Created October 12, 2011 11:36
Dart Compilation
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Simple test program invoked with an option to eagerly
// compile all code that is loaded in the isolate.
// VMOptions=--compile_all
class HelloDartTest {
static testMain() {
print("Hello, Darter!");
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAryfnTaMc15LkUszhjkxR4W3LVj1mlyjqdajR/kYZfBIvlaHIUkegac7S0dbyop61idDrsk4IpDDaF/g54YklGdxICFEtQiLQgk/jD3jrsO0RQAvB3S0B7YUt5IF+8dw3cyEYvD0KVm53DL5BT3RnvAUnjsRHMwwY9rbLbRIrVNMY+Nz9p/r5GBV4MRINq1VIjaUnY4XIH/pv+jqlML5kPfP3OZ6dizrxjwM4tBEaqXm4WL0ARVp/G3Ea6Vx9JA65BZGljvNKe72KklIghV2feZIPhFF0n3GC/RmfVjpYP55x5Uru9KGKDkWv2AuuEORJskiYZ5eDXkEH5TaM+MPYhQ== nerik@imac-de-juliette-champain.local
#########################################################################################################
# I18n French translation for Devise (http://github.com/plataformatec/devise)
# I18n traduction de français pour Devise
#########################################################################################################
fr:
errors:
messages:
not_found: "n'a pas été trouvé(e)"
already_confirmed: "a déjà été confirmé(e)"