Skip to content

Instantly share code, notes, and snippets.

Domenic Denicola domenic

Block or report user

Report or block domenic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rasmuswikman
rasmuswikman / pdf2png.js
Created Nov 1, 2011
PDF to PNG with Node.js and GhostScript
View pdf2png.js
var exec = require('child_process').exec;
var fs = require('fs');
var util = require('util');
var http = require('http');
var url = require('url');
var PDFDocument = require('pdfkit'); // http://pdfkit.org/
http.createServer(function (req, res) {
View SomeKlass.js
var SomeKlass = (function () {
var privates = Name();
return {
public_method: public_method,
public_prop: 42,
constructor: constructor
};
function public_method() {
@Raynos
Raynos / a.md
Created Jan 23, 2012
Shim status of ES6
View a.md

ES6 what can be shimmed and what not.

Currently only lists things that can be shimmed or are experimentally implemented

Note that for any kind of decent ES6 support we need an ES6 transpiler. A few projects are attempting this [Reference SO question][3]

  • [traceur][4]
  • [Caja][5]
  • [ES transpiler][6]
@mkristian
mkristian / pom-compass.xml
Last active Aug 2, 2016
using gem-maven-plugin to compass compile or execute sass. sass with gem dependency within plugin and compass with global compile dependency (which is also added to the java-classpath and not so nice)
View pom-compass.xml
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>0.0.36</version>
View block-lambda-quandry.js
function foo() {
bar({|x|
return 10;
});
}
function bar(block) {
block();
block(); // we should never get here. how?
}
foo();
View node-v0.9-todo.txt
1. Port http_parser.c to JS so we can not keep parsers around forever.
This will be a one-month time-boxed experiment. If it's not acceptable, then
we just have to live with it the way it is now.
2. Clean up lib/http.js. Split into http_client.js and http_server.js
API must remain stable, but code should be separated and organized more clearly.
3. process.nextTick semantics change. Clear the queue after every V8 invocation.
See how rough this is for starvation issues, maybe keep track of the depth, and
do a setTimeout(fn,0) if it's > 10000 or something.
@dominictarr
dominictarr / stream.markdown
Created Jul 15, 2012
Stream tweaks proposal
View stream.markdown

Stream tweaks proposal

The stream is a powerful tool, not just for IO, -- but, in the best Unix tradition -- for composition of modules. I've been connecting streams into quite long chains.

Some streams I have written do not alter the data in the stream, but affect it is some way, such as buffering when the stream is paused. pause-stream

Also, I've been writing high level abstractions that communicate via streams, and do some interesting high level stuff, Such as by replicating data, snob and crdt, or multiplexing mux-demux. Another good example is dnode.

These abstractions expose a stream on their interface, and so can be used over any io channel which supports pipe.

@ritch
ritch / domain-example.js
Created Oct 4, 2012
How to do domains...
View domain-example.js
// based on an example by @mikeal
var http = require('http')
, domain = require('domain')
;
module.exports = function (handler) {
var server = http.createServer(function (req, resp) {
var d = domain.create()
@domenic
domenic / promises.md
Last active Sep 7, 2019
You're Missing the Point of Promises
View promises.md

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
@lukehoban
lukehoban / gist:3900992
Created Oct 16, 2012
ES6 module syntax alternatives
View gist:3900992
Things I want to be able to do:
a) Bind a name to a remote module
b) Alias a name for a module
c) Alias a name for a member of a remote module
d) Put all names from inside a module in lexical scope
e) Put all names from inside a remote module in lexical scope
f) Put a few names from inside a module in lexical scope
g) Define a local module
h) Export names from lexical scope
i) Re-export names from other modules
You can’t perform that action at this time.