This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = require('express').createServer(); | |
app.listen('3030'); | |
app.get('/', function(req, res) { | |
res.contentType('text/plain'); | |
res.send('This is the content', { 'Content-Disposition': 'attachment; filename=name.txt' }); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.printonly { | |
display: none; | |
} | |
@media print { | |
.noprint, nav, footer { | |
display: none; | |
} | |
.printonly { | |
display: block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TokenAdder | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, body = @app.call(env) | |
response = Rack::Response.new body, status, headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include the CoffeeScript interpreter so that .coffee files will work | |
var coffee = require('coffee-script'); | |
// Explicitly register the compiler if required. This became necessary in CS 1.7 | |
if (typeof coffee.register !== 'undefined') coffee.register(); | |
// Include our application file | |
var app = require(process.argv[2] || './app.coffee'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Sometimes I want to munge data that I've pulled from a backend with Angular. The Promises implementation augments the object with it's own $properties and I don't want to munge those. | |
app = angular.module 'GetOffMyLawn' | |
app.controller 'DangKids', ($scope, $resource) -> | |
Wat = $resource '/wat' | |
Wat.get {}, (data) -> | |
#data is something like { foo: {something: 1, somethingElse: 2} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── bin | |
│ └── gotour | |
├── pkg | |
│ └── darwin_amd64 | |
│ └── code.google.com | |
└── src | |
├── code.google.com | |
└── github.com | |
└── davidbanham |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (true) {console.log('Man, you know I can\'t eat your ghost chups.')} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
opts = { | |
domain: 'google.com' | |
} | |
http.get(opts, function(res) { | |
response = '' | |
res.on('data', function(data) { | |
response += data.toString() | |
} | |
res.on('end', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var upnode = require('../'); | |
var dnode = require('dnode'); | |
var test = require('tap').test; | |
var net = require('net'); | |
test('simple', function (t) { | |
t.plan(1); | |
var port = Math.floor(Math.random() * 5e4 + 1e4); | |
var up = upnode.connect(port); |
NewerOlder