Skip to content

Instantly share code, notes, and snippets.

@enricofoltran
enricofoltran / main.go
Last active July 25, 2024 03:38
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
<head>
<title>questions</title>
</head>
<body>
{{loginButtons}}
<div class="container-fluid">
{{> questions}}
</div>
</body>
@maxschulze
maxschulze / html_aware_truncate_helper.rb
Created June 5, 2011 19:55
HTML Aware truncate for Ruby / Rails using nokogiri
# Source:
# http://blog.madebydna.com/all/code/2010/06/04/ruby-helper-to-cleanly-truncate-html.html
require "rubygems"
require "nokogiri"
module TextHelper
def truncate_html(text, max_length, ellipsis = "...")
ellipsis_length = ellipsis.length