This file contains hidden or 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 '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 |
This file contains hidden or 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 '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 => { |
This file contains hidden or 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 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}, |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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 '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 |
This file contains hidden or 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 'rubygems' | |
| require 'sinatra' | |
| get '/' do | |
| "Portland: #{Thread.current[:portland]}" | |
| end | |
| get '/portland' do | |
| Thread.current[:portland] = "is awesome" | |
| redirect '/' |
This file contains hidden or 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
| I18n.locale = @project_role.segment.language rescue I18n.locale = :en | |
| render :layout => layout, :template => "site/#{manage_or_participate}_invite_key" |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| <html> | |
| <head> | |
| <title>This is the title of the website</title> | |
| </head> | |
| <body> | |
| <p id='main_title' style='background: pink;'> | |
| This is content! | |
| </p> |