Skip to content

Instantly share code, notes, and snippets.

var net = require('net');
var mdns = require('mdns');
var serviceKey = mdns.tcp('custom-name');
var discover = mdns.createBrowser(serviceKey);
discover.on('serviceUp', function (service) {
console.log({
port: service.port,
@victorb
victorb / gist:4181764
Last active May 7, 2017 10:09 — forked from davatron5000/gist:2254924
Static Site Generators

This is an updated fork of the gist located here: https://gist.github.com/2254924

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@jeromeetienne
jeromeetienne / README.md
Created July 16, 2012 08:15
coder fun: chained api going too far :)

The code you see below is a funny building of chained API :) it is a particle emitter for flame throwers. look at the running demo. I love the end of the flame. all in a single chained instruction. Recently i did all my libraries with chained api and i like it. the lib used below is fireworks.js. This particular emitter is a bit too much chained tho :)

but still i look at the size of the source and at the effect on the screen... you got a pretty cool looking effects for 60lines of javascript. maybe i should just break it in several instructions... would be artificial but hey :)

= a coder having fun

@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@getify
getify / gist:3057796
Created July 6, 2012 02:58
exploring javascript type auto-coercion (and its pitfalls)
// **********
// NOTE: this is a stupid trivial example illustrating automatic
// type-coercion, not an example of the kind of data-structure logic
// you'd ever actually use. don't miss the forest for the trees.
// Read down in the comment thread for 'myCoolString' for a slightly
// more sensible example.
//
// NOTE #2: this gist thread was spawned from a twitter discussion
// about `parseInt(0/1,19)==18`:
// https://twitter.com/getify/status/221009838006747136
@ThisIsMissEm
ThisIsMissEm / requireDir.js
Created July 4, 2012 14:42 — forked from TheDeveloper/requireDir.js
Node.js require directory
var fs = require('fs');
var Path = require('path');
function requireDir(dir){
var modules = {};
fs.readdirSync(dir).map(function(name){
return Path.join(dir, name);
}).filter(function(path){
return fs.statSync(path).isFile();
@paulrouget
paulrouget / es6.js
Last active October 6, 2015 07:07
Some ECMAScript 6 element are available in Firefox
// To test this code in Firefox, I encourage you to use Firefox Aurora
// and to include your script this way:
// <script type="application/javascript;version=1.8">
// (necessary to make `let` work)
/* let ********************************************* */
// let is the new var :)
// Declares a block scope local variable
@karlseguin
karlseguin / gist:2724327
Created May 18, 2012 09:43
Collects all the IDs and classes from a given element down (like document.body)
function scan(parent) {
var found = {classes: {}, ids: []};
var unexamined = [parent];
while (unexamined.length > 0) {
parent = unexamined.pop();
var nodeLength = parent.childNodes.length;
for(var i = 0; i < nodeLength; ++i) {
node = parent.childNodes[i];
if (node.nodeType != 1) { continue; }
@adamsilver
adamsilver / Questions.md
Created May 14, 2012 12:35 — forked from Integralist/Questions.md
Recruitment Questions for front-end developer (modified from https://github.com/darcyclarke/Front-end-Developer-Interview-Questions)

##JavaScript specific Questions

  • Which JavaScript libraries have you used?
  • How is JavaScript different from Java?
  • What are undefined and undeclared variables?
  • What is an expression?
  • What is a statement?
  • Give an example of a function declaration
  • Give an example of a function expression
  • Explain what the DOM is and some best practices for interacting with it.
@sindresorhus
sindresorhus / LICENSE.txt
Created May 14, 2012 10:35 — forked from 140bytes/LICENSE.txt
View source - view the generated source of a page (140byt.es)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Sindre Sorhus <http://sindresorhus.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE