Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Wheeler AlexWheeler

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