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);
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 / check_ins.hbs
Created January 16, 2014 14:54
checkins
{{#each . }}
<li class="">
<div class="icon"><img src="{{icon}}" alt="" class="img-responsive"></div>
<div class="details">
<strong title="{{name}}">{{name}}</strong>
<time>{{stamp}}</time>
<address>{{vicinity}}</address>
<cite>{{userName}}</cite>
{{#if comment}}
<q>{{comment}}</q>
@jblanche
jblanche / favorites.md
Created November 8, 2013 10:11
Favorites

Pour moi le plus simple à gérer ce serait on a une hive

/hives/{id}

qui nous a renvoyer

{
  "_links": {
    "favorite": "/hives/2/favorites/{userId}"

}

The question is, how do we create linked resources with the main one, e.g. if for some business reasons a user is created with an avatar and the avatar is a different resource because it can be associated with other stuff than a user...
What should be the format of the POST request on /users doing this ?
@jblanche
jblanche / infos.md
Last active December 16, 2015 18:08
Changer de FAI ?

Pourquoi

Critères

  • Neutralité du réseau
  • Prix (dans une certaine mesure, vu l'importance d'un bon accès pour moi, je suis prêt à payer plus si le sevice en vaut la peine).
  • Accès TV "sport" : Personne n'est parfait et ma consommation de la TV est majoritairement composée de sport ( Canal+ et BeIN Sport), donc si possible, accès simple à ces chaînes…
@jblanche
jblanche / error
Last active December 16, 2015 04:49
Gruntfile or requirejs bug
Running "requirejs:dist" (requirejs) task
>> Error: Error: The "out" and "dir" options are incompatible. Use "out" if you are targeting a single file for for optimization, and "dir" if you want the appDir or baseUrl directories optimized.
>> at Function.build.createConfig (xxx/node_modules/grunt-requirejs/node_modules/requirejs/bin/r.js:23730:19)
Warning: Task "requirejs:dist" failed. Use --force to continue.
@jblanche
jblanche / comparison.md
Last active March 29, 2016 17:40
Should I use Angular / Backbone or Ember ?

AngularJS

Pros

  • Perfect for complex "client-side" application, where the complexity is more in the way "components" of an app interacts with each other than in the way they sync and or interact with a backend.
  • Very clean separation of concerns
  • Uses concepts that kind of look likes the future of HTML/DOM (DOM templates, binding attributes…).

Cons

  • A bit complicated to grasp. A lot of new concepts.
@jblanche
jblanche / lemonde-cleaner.js
Created December 30, 2012 16:43
Le monde cleaner
[].forEach.call(
document.querySelectorAll('a.lien_interne'), function(el){
el.outerHTML = el.innerText;
}
);