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
unless params[:name].empty? and params[:msg].empty? | |
if params[:msg].length <= 140 and params[:name]. length <= 10 | |
$msgs << [params[:name],params[:msg]] | |
"Send success!<a href=\"/\">Go to home!</a>" | |
else | |
"Error! Big message or name: #{params[:name]} say \"#{params[:msg]}\"<br/><a href=\"/\">Go to home!</a>}" | |
end | |
else | |
"Empty!<a href=\"/\">Go to home!</a>" | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
# TODO: rewrite it to class | |
form = <<TEXT | |
<form action="/post" method="POST"> | |
Name: <input name="name" value="" size="10"><br> | |
Message: <input name="msg" value="" size="140"><br> | |
<center><input type="submit"></center> |
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
<%5.times do |n|%> | |
<a href='/ads'>Pay <%=n%> ads for you site here!</a> | |
<%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
erb :main_layout, :layout => false do | |
erb :admin_layout do | |
erb :user | |
end | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'erb' | |
require 'sinatra' | |
enable :sessions | |
$msgs = Array.new | |
# added a explot guard |
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
<form action='/post' method='POST'> | |
Name: <input name='name' value='<%unless session[:name].empty? do%><%=session[:name]%><%end%>' size='10'><br/> | |
Message: <input name='msg' value='<%unless session[:msg].empty? do%><%=session[:msg]%><%end%>' size='140'><br/> | |
<input type='submit'> | |
</form> | |
<br/> |
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 'sequel' | |
DB = "sqlite://application.db" | |
def added_message(name, msg) | |
# added a message in posts database | |
Sequel.connect(DB) do |db| | |
posts = db[:posts] | |
posts.insert(:time => Time.now.to_s, :name => name, :msg => msg) | |
end | |
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
#LyX 2.0 created this file. For more info see http://www.lyx.org/ | |
\lyxformat 413 | |
\begin_document | |
\begin_header | |
\textclass article | |
\use_default_options true | |
\maintain_unincluded_children false | |
\language english | |
\language_package default | |
\inputencoding auto |
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
#LyX 2.0 created this file. For more info see http://www.lyx.org/ | |
\lyxformat 413 | |
\begin_document | |
\begin_header | |
\textclass article | |
\use_default_options true | |
\maintain_unincluded_children false | |
\language english | |
\language_package default | |
\inputencoding auto |
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
{ | |
"translator": "NCase", | |
"app": { | |
"name": "Nothing To Hide", | |
"subtitle": "an anti-stealth game where you are your own watchdog.", | |
"longtitle": "Nothing To Hide: an anti-stealth game where you are your own watchdog." | |
}, | |
"menu": { | |
"play": "PLAY", | |
"support": "SUPPORT & SHARE", |
OlderNewer