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
<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(); | |
} |
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
class MyClass | |
include MyModule | |
def setup | |
@foo = :bar | |
end | |
end | |
module MyModule | |
def setup |
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
# 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 { |
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
require 'rack' | |
class RemoveBadWords | |
BAD_WORDS = %w(emacs).freeze | |
def initialize(app) | |
@app = app | |
end | |
def call(env) |
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
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 |
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
constraints(IphoneAdmin) do | |
#your routes | |
end |
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
constraints(subdomain: ['admin', 'staging']) do | |
get 'properties', to: 'properties#show' | |
post 'properties', to: 'properties#create' | |
get 'dashboard', to: 'main#dashboard' | |
end |
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
root 'iphone#index', constraints: lambda { |req| req.env['HTTP_USER_AGENT'] =~ /iPhone/ } | |
root 'web#index' |
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
get 'dashboard', to: 'dashboard#index', constraints: { subdomain: 'staging' } |
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
get 'properties/:slug', to: 'properties#show', constraints: { slug: /[a-z]+\.\d+/ } |