Skip to content

Instantly share code, notes, and snippets.

View jpoz's full-sized avatar
:shipit:

James Pozdena jpoz

:shipit:
  • Boulder, CO
  • 22:54 (UTC -06:00)
View GitHub Profile
require 'pony'
require "openssl"
require "net/smtp"
Net::SMTP.class_eval do
private
def do_start(helodomain, user, secret, authtype)
raise IOError, 'SMTP session already started' if @started
check_auth_args user, secret, authtype if user or secret
require 'rubygems'
require 'sinatra'
require 'pony_gmail' # the file that's linked above
post '/' do
Pony.mail(:to=>"someeamil@example.com",
:from => 'yourgmail@yourdomian.com',
:subject=> "SUBJECT",
:body => "BODY",
:via => :smtp, :smtp => {
class String
def to_leet(random=false)
leet_alphabet = { :a => %w{ @ 4 /\ /-\ ^ aye ∂ ci λ Z},
:b => %w{ ß 6 8 13 I3 |3 P> |: !3 (3 /3 )3 ]3},
:c => %w{ ( ¢ < ©},
:d => %w{ [) |) |o ∂ ]) I> |> T) 0 ð cl},
:e => %w{ 3 & € £ ë [- |=-},
:f => %w{ |= ]= ph \} (= I=},
:g => %w{ 6 & (_+ 9 C- gee (γ, (_- cj},
def sqrt(number)
num = min = 0.0
max = number
while true do
num = (min + ((max-min) / 2.0))
t = (num * num)
break if t == number
t > number ? max = num : min = num
end
num
module APNS
def self.send_notifications(notifications)
sock, ssl = self.open_connection
notifications.each do |n|
ssl.write(self.packaged_notification(n[0], n[1]))
end
ssl.close
require 'rubygems'
require 'sinatra'
require 'almaz'
use Almaz::Capture # used to capture all requests
use Almaz::View # add /stats
Almaz::View.user('jpoz','pass') # set your username and password here for the /stats area
get '/' do
require 'rubygems'
require 'sinatra'
get '/' do
"Portland: #{Thread.current[:portland]}"
end
get '/portland' do
Thread.current[:portland] = "is awesome"
redirect '/'
I18n.locale = @project_role.segment.language rescue I18n.locale = :en
render :layout => layout, :template => "site/#{manage_or_participate}_invite_key"
diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb
index 9b33c31..ac6d091 100644
--- a/app/controllers/site_controller.rb
+++ b/app/controllers/site_controller.rb
@@ -59,6 +59,8 @@ class SiteController < ApplicationController
participant_registration and return if request.post?
layout = "minimal_#{manage_or_participate}"
+
+ I18n.locale = @project_role.segment.language rescue I18n.locale = :en
<html>
<head>
<title>This is the title of the website</title>
</head>
<body>
<p id='main_title' style='background: pink;'>
This is content!
</p>