For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
=> ["brdrps-LOE120125", "brdrps-BUS110134", "brdrps-NBL090083", "brdrps-BNH130002", "brdrps-LSK130190", "brdrps-PNL070117", "brdrps-STH120012", "brdrps-NEW140054", "brdrps-TQY130352", "brdrps-SHA120045", "brdrps-NWL090069", "brdrps-BUS120046", "brdrps-TQY120113", "brdrps-PSK110326", "brdrps-HEL110179", "brdrps-SHA130015", "brdrps-PYL080012", "brdrps-EEL070240", "brdrps-NAB120427", "brdrps-CAL120101", "brdrps-NAB120332", "brdrps-STH130225", "brdrps-NEW110193", "brdrps-SHA120021", "brdrps-CAL110006", "brdrps-EXE130418", "brdrps-CAL110220", "brdrps-PEN130119", "brdrps-HLR100002", "brdrps-PEN120089", "brdrps-PSK100387", "brdrps-PGN120407", "brdrps-EXE130150", "brdrps-EXM110211", "brdrps-CAL100240", "brdrps-OKE130223", "brdrps-SAL110236", "brdrps-EXM120168", "brdrps-OEL070077", "brdrps-STH130218", "brdrps-NBL080040", "brdrps-HLR090006", "brdrps-EXM130502", "brdrps-EXM130441", "brdrps-NEW130277", "brdrps-PNL070059", "brdrps-BUS100142", "brdrps-NAB120458", "brdrps-EXE130502", "brdrps-PSK130259", "brdrps-BUR090028", |
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
# This gets X users within a distance of '10' radians | |
user = User.find_me_a_bloody_user | |
result = ActiveRecord::Base.connection.execute(" | |
SELECT | |
((ACOS( SIN( #{user.lat} * PI( ) /180 ) * SIN( latitude * PI( ) /180 ) + COS( #{user.lat} * PI( ) /180 ) * COS( latitude * PI( ) /180 ) * COS( ( | |
#{user.lng} - longitude) * PI( ) /180 ) ) *180 / PI( ) ) *60 * 1.1515) |
class User < ActiveRecord::Base | |
end | |
class UsersController < ApplicationController | |
def update | |
User.find(params[:id]).update_attributes(params[:user]) | |
end | |
end |
class PostsController < ActionController::Base | |
after_filter :set_http_cache, :only => :index | |
private | |
def set_http_cache | |
expires_in(30.seconds, :public => true) | |
end | |
end |
{% rss source: http://rubysource.com/feed/%} | |
<article class='main rss_list'> | |
<h1>{{ feed.title }}</h1> | |
{% for item in feed.items limit:3%} | |
<section> | |
<h1><a href='{{item.link}}'>{{item.title}}</a></h1> | |
<p>{{item.description}}</p> | |
</section> | |
<hr/> | |
{%endfor%} |
template = "{{foo}}" | |
Liquid::Template.parse(template).render({'foo' => 'bar'}) |
{{ 'world' | prepend:'hello' | upcase }} |
#{{ some_text | truncate: 20, '' }} | |
def truncate(input, length = 50, truncate_string = "...") | |
if input.nil? then return end | |
l = length.to_i - truncate_string.length | |
l = 0 if l < 0 | |
input.length > length.to_i ? input[0...l] + truncate_string : input | |
end |