Skip to content

Instantly share code, notes, and snippets.

View ilmsg's full-sized avatar
😍
love me love my bug

Eak Netpanya ilmsg

😍
love me love my bug
View GitHub Profile
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Peanut Butter and Jelly Sandwich</title>
<style type="text/css">
body {
margin: 0px;
padding: 0px;
}
<div id="fb-root"></div>
<script src="http://static.ak.fbcdn.net/connect/en_US/core.js"></script>
<div id="content">
<div align="right"><fb:login-button autologoutlink="true" v="2"></fb:login-button>
</div>
<h1>Recipes For You on Facebook</h1>
<h3>Peanut Butter and Jelly Sandwich &nbsp; &nbsp; <button onClick="triedIt();">I Tried This!</button></h3>
2 slices bread<br>
1 T peanut butter<br>
@hubgit
hubgit / node-redis-visitor-counter.js
Created May 13, 2010 14:42
A basic visitor counter for Node.js, storing counters in Redis
// embed an img element in an HTML page, point it at this.
var sys = require("sys"), http = require("http"), crypto = require("crypto");
var db = require("redis-client").createClient();
http.createServer(function(request, response) {
var date = new Date;
var day = date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate();
* ry/node
* ry/node_chat
* ry/node_docs
* Connorhd/node_debug
* extjs/Connect
* jcoglan/faye
* Sannis/node-mysql-libmysqlclient
* creationix/wheat
* felixge/node-formidable
* LearnBoost/mongoose
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
@steren
steren / Application.java
Created November 3, 2010 10:22
Upload and store image with Play! Framework
public class Application extends Controller {
public static void index() {
render();
}
public static void uploadPicture(Picture picture) {
picture.save();
index();
}
@ryanflorence
ryanflorence / static_server.js
Last active February 27, 2025 06:28
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@creationix
creationix / chatServer.js
Created November 19, 2010 20:47
A simple TCP based chat server written in node.js
// Load the TCP Library
net = require('net');
// Keep track of the chat clients
var clients = [];
// Start a TCP Server
net.createServer(function (socket) {
// Identify this client
@dachev
dachev / simple_crontab_reboot_example.js
Created January 3, 2011 03:02
Simple reboot example
require('crontab').load(cronLoaded);
function cronLoaded(err, tab) {
if (err) { console.log(err); process.exit(1); }
var command = '/usr/bin/env echo "starting some service..."';
tab.remove(tab.findCommand(command));
var item = tab.create(command);
item.everyReboot();
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go