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
// Minimalish, self-contained demo program for | |
// https://github.com/radovskyb/watcher | |
// slightly changed version of https://gist.github.com/tomcam/32760a5049a00ec6ba82bcb42b6759fc | |
// | |
// Here's what this code does. | |
// 1. Creates a small tree of files for a minimal website. | |
// 2. Places those files in the directory WWW (configurable). | |
// 3. Watches the WWW directory and its children. | |
// 4. Refreshes the web page when changes happen | |
// |
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
// Minimalish, self-contained demo program for | |
// https://github.com/radovskyb/watcher | |
// | |
// Here's what this code does. | |
// 1. Creates a small tree of files for a minimal website. | |
// 2. Places those files in the directory WWW (configurable). | |
// 3. Watches the WWW directory and its childrens. | |
// | |
// To use it: | |
// 1. Open up a terminal |
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
// Create a small tree of files for a minimal website. | |
// Run program then open the file WWW/index.html | |
package main | |
import ( | |
"os" | |
"path/filepath" | |
) | |
var ( |
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
// dl displays a list of directories. Starts at current dir unless | |
// another is given on the command line. Counts theme. | |
// Naively written; doesn't do a good job when you don't have | |
// the right permissions. | |
// Usage: | |
// dl [directory] | |
package main | |
import ( |
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 ( | |
"fmt" | |
"os" | |
"path/filepath" | |
) | |
func main() { | |
// golang removes thet trailing path separator. |
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 ( | |
"fmt" | |
"io/ioutil" | |
"gopkg.in/yaml.v3" | |
"os" | |
) | |
type Theme struct { |
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 ( | |
"embed" | |
"fmt" | |
"io/fs" | |
) | |
// The following embeds all files and subdirectories | |
// from the themes subdirectory of this package into |
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
// Demonstrates the goldmark Markdown to HTML converter. | |
// Reads name of input file from command line, or creates a | |
// simple Markdown source file named "foo.md". | |
// Calls goldmark to convert it to HTML. | |
// Displays results to standard output. | |
package main | |
import ( | |
"bytes" | |
"fmt" |
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
from py4web import action, request, abort, redirect, URL | |
from yatl.helpers import A | |
from .common import db, session, T, cache, auth, logger, authenticated, unauthenticated | |
from py4web import Field | |
from py4web.utils.form import Form | |
from py4web import response | |
@action('index') | |
@action.uses(auth, 'index.html') |
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/zsh | |
ls -d */ |
NewerOlder