Skip to content

Instantly share code, notes, and snippets.

@inhies
inhies / server.go
Last active October 13, 2023 22:21
A basic web server that will serve templates and reload them when they are changed on disk
package main
import (
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"strings"
@lukevers
lukevers / NewUser.php
Last active August 29, 2015 14:18
App\Tips\Tip
<?php namespace App\Tips;
class NewUser extends Tip {
/**
* An array of tips.
*
* @var array
*/
protected $tips = [
@lukevers
lukevers / OTF.php
Last active October 5, 2020 22:19
Laravel 5 On The Fly Database Connections
<?php namespace App\Database;
use Config;
use DB;
class OTF {
/**
* The name of the database we're connecting to on the fly.
*
@prurigro
prurigro / browser-remote-watch.sh
Last active August 29, 2015 14:16
Reload the webpage in Firefox when the source file changes
#!/usr/bin/env bash
#
# browser-remote-watch: reload the page when the source changes
#
# Version 1.1
#
# Written by Kevin MacMartin (prurigro@gmail.com)
# Released under the MIT license
#
@pjv
pjv / hhvm.conf
Last active January 18, 2016 18:04
Ubuntu 14.04 upstart script for HHVM
# hhvm - HipHop VM
#
# The HipHopVM server provides a high performance PHP stack and web server.
# modified by pjv from original found here: http://stackoverflow.com/questions/19013516/upstart-script-for-hhvm-hiphop
description "HHVM server"
author "pjv https://gist.github.com/pjv/2e9ab32d8d9884bf79a4"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
@cryptix
cryptix / vineScrape.go
Created August 27, 2014 12:31
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@inhies
inhies / ddd.go
Created November 17, 2013 06:06
Demonstration of using tons of go routines to http.Get lots of web pages.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"runtime"
"sync"
)
@alexander-bauer
alexander-bauer / blog
Last active December 20, 2015 16:18
Small utility for composing trofaf blogposts
#!/bin/bash
#
## blog
#
# This script creates a temporary file with [trofaf][] header data and
# opens it with an editor. When this is saved and closed, the file is
# moved to a particular directory with a title given either as the
# first argument, or read on the command line after completion.
#
# Once the file has been successfully renamed to markdown, if REGENDIR
@lukevers
lukevers / bot.pl
Created July 18, 2013 00:52
IPv6 support for idleRPG http://idlerpg.net/
#!/usr/local/bin/perl
# irpg bot v3.1.2 by jotun, jotun@idlerpg.net, et al. See http://idlerpg.net/
#
# Some code within this file was written by authors other than myself. As such,
# distributing this code or distributing modified versions of this code is
# strictly prohibited without written authorization from the authors. Contact
# jotun@idlerpg.net. Please note that this may change (at any time, no less) if
# authorization for distribution is given by patch submitters.
#
# As a side note, patches submitted for this project are automatically taken to
@alexander-bauer
alexander-bauer / vup
Created November 7, 2012 01:03
Bash script for upping version numbers and creating git tags
#!/bin/bash
# This script bumps the version number of a Go project. The variable "Version"
# should be declared as a constant in the file that matches the name of the
# project. For example, a project contained in example/ should declare Version
# in example.go.
#
# To use: vup <level>
#
# <level> is the depth of the bump, determined by number of periods
# to the left of the number. For example, bumping v1 to v2 is a level