Skip to content

Instantly share code, notes, and snippets.

View nelsonsilva's full-sized avatar

Nelson Silva nelsonsilva

View GitHub Profile
@nelsonsilva
nelsonsilva / gist:1180573
Created August 30, 2011 09:53
Node.js httpd
var http = require('http');
http.createServer(function (req, res) {
res.writeHeader(200, {'Content-Type': 'text/plain'});
res.end('Hello World');
}).listen(8000);
console.log('Server running at http://127.0.0.1:8000/');
@nelsonsilva
nelsonsilva / gist:1180574
Created August 30, 2011 09:54
Golang httpd
package main
import (
"http"
"fmt"
)
func HelloServer(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "hello, world!\n");
}
func main() {
http.HandleFunc("/", HelloServer);
@nelsonsilva
nelsonsilva / mysocial-config.xml
Created September 9, 2012 00:08
Using the default domain for document management and social collaboration in Nuxeo
<?xml version="1.0"?>
<component name="pt.inevo.social.mix" version="1.0">
<require>org.nuxeo.ecm.platform.types</require>
<require>org.nuxeo.ecm.social.workspace.types</require>
<require>org.nuxeo.ecm.social.workspace.service.SocialWorkspaceService.contrib</require>
<extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
<!-- from nuxeo-platform-webapp-base-5.6-RC1.jar /OSGI-INF/ecm-types-contrib.xml -->
@nelsonsilva
nelsonsilva / bamboo_agent.sh
Last active March 2, 2022 05:15
Bamboo Ubuntu bootstrap
#!/bin/sh
# wget this script and run "sudo sh bamboo_agent.sh"
# Enable the multiverse repos
sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list
apt-get update
# Install the deps
#!/bin/sh
# Git
sudo apt-get -y install git
# node.js
NODE_VERSION=0.10.18
curl http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz | tar xzv
ln -s node-v$NODE_VERSION-linux-x64 node-0.10
@nelsonsilva
nelsonsilva / gh.dart
Created October 30, 2013 17:30
Simple GH Dart repo listing app to test http imports.
import 'dart:async';
import 'dart:convert' show JSON;
import 'dart:io';
import 'http://github.com/lord-otori/ascii_tables/raw/master/lib/ascii_tables.dart';
main() {
new HttpClient()
.getUrl(Uri.parse("https://api.github.com/search/repositories?q=language:dart&sort=stars&order=desc"))
.then((req) {
req.headers.add(HttpHeaders.USER_AGENT, "dart");
import 'package:http/http.dart' as http;
import 'dart:async';
import 'dart:convert';
import 'dart:io';
Future<Iterable> getGistsForUser(String user) => http.get("https://api.github.com/users/$user/gists")
.then((res) => JSON.decode(res.body).map((e) => e["html_url"]));
prompt(txt) { stdout.write(txt); return stdin.readLineSync(); }
@nelsonsilva
nelsonsilva / designer.html
Last active August 29, 2015 14:03
designer
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../font-roboto/roboto.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../nuxeo-elements/nx-connection.html">
<link rel="import" href="../nuxeo-elements/nx-content-view.html">
<link rel="import" href="../nuxeo-elements/nx-page-provider.html">
<nx-connection id="nx_connection" url="http://demo.nuxeo.com/nuxeo"></nx-connection>
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;