Skip to content

Instantly share code, notes, and snippets.

View AlexWheeler's full-sized avatar

Alex Wheeler AlexWheeler

View GitHub Profile
<div id="player">Click ME FRITZ</div>
<script>
var player = new Audio("/img/songs/test.mp3"); // or wherever this is being served from
$(document).ready(function() {
$('#player').click(function(){
player.play();
}
class MyClass
include MyModule
def setup
@foo = :bar
end
end
module MyModule
def setup
# 1. Install nginx
brew install nginx
# 2. Generate self-signed key/crt
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout /etc/ssl/private/myssl.key \
-out /etc/ssl/certs/myssl.crt
# 3. Edit nginx config located at: /usr/local/etc/nginx/nginx.conf
server {
require 'rack'
class RemoveBadWords
BAD_WORDS = %w(emacs).freeze
def initialize(app)
@app = app
end
def call(env)
require 'rack'
#run proc { |env| ['200', { 'Content-Type' => 'text/html' }, ['code is a liability']] }
class MyRackApp
def call(env)
['200', { 'Content-Type' => 'text/html' }, ['code is a liability']]
end
end
run MyRackApp.new
constraints(IphoneAdmin) do
#your routes
end
constraints(subdomain: ['admin', 'staging']) do
get 'properties', to: 'properties#show'
post 'properties', to: 'properties#create'
get 'dashboard', to: 'main#dashboard'
end
root 'iphone#index', constraints: lambda { |req| req.env['HTTP_USER_AGENT'] =~ /iPhone/ }
root 'web#index'
get 'dashboard', to: 'dashboard#index', constraints: { subdomain: 'staging' }
get 'properties/:slug', to: 'properties#show', constraints: { slug: /[a-z]+\.\d+/ }