(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
/* | |
12306 Auto Submit => A javascript snippet to help you auto submit. | |
Copyright (C) 2011 Kevintop | |
Includes jQuery | |
Copyright 2011, John Resig | |
Dual licensed under the MIT or GPL Version 2 licenses. | |
http://jquery.org/license | |
Includes 12306.user.js |
# Validates whether the value of the specified attribute matches the format of an URL, | |
# as defined by RFC 2396. See URI#parse for more information on URI decompositon and parsing. | |
# | |
# This method doesn't validate the existence of the domain, nor it validates the domain itself. | |
# | |
# Allowed values include http://foo.bar, http://www.foo.bar and even http://foo. | |
# Please note that http://foo is a valid URL, as well http://localhost. | |
# It's up to you to extend the validation with additional constraints. | |
# | |
# class Site < ActiveRecord::Base |
Warden::Strategies.add(:bcrypt) do | |
def valid? | |
params[:username] || params[:password] | |
end | |
def authenticate! | |
return fail! unless user = User.first(:username => params[:username]) | |
if user.encrypted_password == params[:password] | |
success!(user) |
# ... | |
gem 'padrino-warden', :git => "git://github.com/zmack/padrino-warden.git" | |
gem 'authtools' |
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- | |
-- Number => INT or DOUBLE PRECISION | |
-- String => TEXT |
curl https://raw.github.com/gist/3342482/57d1f618104185aa89044f934c4f86cb74e11553/rbenv-openshift.sh | bash |
fs = require 'fs' | |
path= require 'path' | |
tmp = require 'tmp' | |
tmp.setGracefulCleanup() | |
folderIsInsensitive = (aFolder)-> | |
aFolder ?= '.' | |
t = tmp.fileSync template:path.join aFolder, '_tmp-XXXXXXXXX' | |
result = fs.existsSync t.name.toUpperCase() | |
t.removeCallback() |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
docker network create etcd --subnet 172.19.0.0/16 | |
docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \ | |
-name etcd0 \ | |
-advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \ | |
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://172.19.1.10:2380 \ | |
-listen-peer-urls http://0.0.0.0:2380 \ | |
-initial-cluster-token etcd-cluster-1 \ | |
-initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \ |
When running virtual machines under a Linux host system for testing web apps in various browsers (e.g. Internet Explorer), I found it rather tedious having to continually tweak the hosts file within each VM for the purpose of adding entries pointing back to the host machine's development web server address.
Instead the steps below will setup Dnsmasq on a Ubuntu 16.04LTS, 14.04LTS or 12.04LTS host machine for the purpose of serving both it's own DNS queries and that of virtual machine guests. Dnsmasq will parse the /etc/hosts
file on your host machine where we will keep a single set of DNS entires to our test web application(s).