Skip to content

Instantly share code, notes, and snippets.

@hugs
hugs / LICENSE
Created February 15, 2010 01:45
The Node.js "Hello World" web server ported to CoffeeScript
I, Jason Huggins, the author of the work "CoffeeScript Web Server" (2010), irrevocably renounce
all current and future legal rights to the work in any medium whatsoever.
I stand behind the merit of the work, but disclaim all liability for it under law.
I encourage you, the audience, to share, copy, distribute, perform, remix, mash up, interpret,
excerpt, translate, and otherwise enjoy and use the work as you will.
I request that you acknowledge my authorship.
# [sudo] gem install rack
# ruby -rubygems server.rb
# open http://localhost:9292 in browser.
require 'rack'
require 'erb'
TEMPLATE = File.read("template.erb")
server = lambda do |env|
run "rm public/index.html"
file "Isolate", <<-END
gem "rails", "3.0.0"
gem "haml", "3.0.18"
gem "sqlite3-ruby", "1.3.1"
env :development do
gem "thin", "1.2.7"
gem "haml-rails", "0.2"
@chrissharkey
chrissharkey / agedate.html
Created March 7, 2011 23:51
Calculate the age of person you can date based on your net worth
<html>
<head>
<title>Age Dating Calculator</title>
<script>
<!--
/* This function does the actual calculation as described in your email*/
function calculate(age, worth) {
/* If they are less than 14 assume they wouldn't date anyone more than 1 year
@EmmanuelOga
EmmanuelOga / layout.html.erb
Created April 26, 2011 20:04
simple packager for rails 3.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Look ma, single css and js packages! (but not on dev mode).</title>
<%= include_packaged_styles "generic.css" %>
<%= include_packaged_scripts "generic.js" %>
<%= yield :head %>
</head>
<body>
@tlhl28
tlhl28 / gist:1053143
Created June 29, 2011 04:26
Simple mysql query class --- php
<?php
/**
* ======Usage=====
*
* $db = new Database("127.0.0.1","user","pwd","db1");
* $data = $db->selectDb("db2")
* ->selectTable("table1")
* ->show("column1 as no1")
* ->filter("column1 >", 0)
* ->filter("column2 LIKE", "%hello%")
@arbovm
arbovm / server_setup.md
Created July 27, 2011 16:05 — forked from erotte/server_setup.md
Server Setup Ubuntu 10.4/rvm/nginx/passenger Hosteurope VM

Server Setup

Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.

Installation der benötigten Pakete

apt-get update

apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \

@farnoy
farnoy / main.go
Created February 12, 2012 10:38
golang websockets
package main
import (
"websocket"
"http"
"fmt"
"io"
)
func EchoServer(ws *websocket.Conn) {
@nemf
nemf / gist:3109649
Created July 14, 2012 06:09
Minimal Kickstart for CentOS 6.3
install
url --url http://ftp.iij.ad.jp/pub/linux/centos/6.3/os/x86_64/
# if you use proxy
# url --url http://ftp.iij.ad.jp/pub/linux/centos/6.3/os/x86_64/ --proxy http://proxy-ip:8080/
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp
rootpw password
firewall --disabled
authconfig --enableshadow --passalgo=sha512
anonymous
anonymous / mysql wrapper class
Created July 19, 2012 02:24
MySql Connection pool & Auto reconnection
/*
use ver 2
provide:
connection pool
auto reconnect
Usage:
MySql = require 'lib/mysql' This one
mysql = new MySql(Config)