This file contains hidden or 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" | |
type Person struct { | |
Name string | |
} | |
func main() { | |
myhash := make(map[string]Person) |
This file contains hidden or 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
require 'blather/client/client' | |
require 'blather/client/dsl' | |
module DaemonKit | |
# Thin wrapper around the blather DSL | |
class XMPP | |
include ::Blather::DSL | |
class << self |
This file contains hidden or 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
# MongoDB | |
# | |
# VERSION 0.0.1 | |
# | |
# requires mongodb.conf @ https://gist.github.com/ijonas/6844358 | |
FROM ubuntu | |
MAINTAINER [email protected] | |
# make sure the package repository is up to date |
This file contains hidden or 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
# MySQL service | |
# | |
# Version 0.0.1 | |
FROM ubuntu | |
MAINTAINER support@caseblocks | |
RUN dpkg-divert --local --rename --add /sbin/initctl | |
RUN ln -s /bin/true /sbin/initctl |
This file contains hidden or 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
class Kisselbugger | |
def something_that_evaluates_to_true | |
# ... | |
end | |
def decide_and_do_something | |
# several hours of looking at line 9 results in a: "AArgh, ya wee bugger. Not again!" | |
if not something_that_evaluates_to_true | |
do_the_true_response |
This file contains hidden or 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
# after launching an Ubuntu 12.04 instance and ssh-ing into the VM | |
apt-get update | |
apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring | |
reboot | |
# ssh-ing back into the VM | |
sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -" | |
sh -c "echo deb http://get.docker.io/ubuntu docker main /etc/apt/sources.list.d/docker.list" | |
apt-get update | |
apt-get install lxc-docker |
This file contains hidden or 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
if configBytes, err := ioutil.ReadFile(fmt.Sprintf("%s/%s", os.Getenv("HOME"), ".ddknife")); err == nil { | |
for _, row := range strings.Split(string(configBytes), "\n") { | |
if tuple := strings.Split(row, "="); len(tuple) == 2 { | |
configFileSettings[tuple[0]] = tuple[1] | |
} | |
} | |
} |
This file contains hidden or 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" | |
"math/rand" | |
"time" | |
) | |
func main() { | |
r := rand.New(rand.NewSource(99)) |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "opscode/ubuntu1404" | |
config.vm.network "forwarded_port", guest: 80, host: 8090 | |
config.vm.network "forwarded_port", guest: 3306, host: 3306 | |
config.vm.network "forwarded_port", guest: 9200, host: 9200 |
This file contains hidden or 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
class Product < ActiveRecord::Base | |
validates :title, :description, :image_url, :presence=> true | |
validates :price, :numericality => {:greater_than_or_equal_to => 0.01} | |
validates :title, :uniqueness => true | |
validates :image_url, format: { | |
:with => %r{\.(gif|jpg|png)\Z}i, | |
:message => 'must be a url' | |
} | |
def ordered_by_title |