Skip to content

Instantly share code, notes, and snippets.

View davidedicillo's full-sized avatar
🤓

Davide Di Cillo davidedicillo

🤓
View GitHub Profile
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Welcome to Wist</title>
<style media="all" type="text/css">
html, body {
height: 100%;
}
def create
@question = Question.find(params[:question_id])
@answer = @question.answers.create(params[:answer].permit(:option, :user_id, :question_id))
@nextquestion = Question.where.not(user_id: current_user.id).last
@index = 0
while @nextquestion.answers.where(:user_id => current_user.id).count != 0 && @index < Question.all.count do
class Answer < ActiveRecord::Base
belongs_to :user
belongs_to :question
end
class Question < ActiveRecord::Base
/* ---------- iOS devices ---------- */
.ipad-only, .iphone-only, .retina-only, .non-retina-only, .retina-iphone-only, .non-retina-iphone-only { display: none; }
/* ---------- iPad Only ---------- */
@media only screen and (device-width: 768px) {
.ipad-only { display: block; }
}
/* ---------- iPhone/iPod Only ---------- */
@media only screen and (device-width: 320px) {
filename = 'birthdays.txt'
file_string = File.read filename
birthdays = {}
person = ()
file_string.each_line do |line|
line = line.chomp
arr = line.split(', ')
dict_array = []
dict_hash = []
dict_array[0] = 'candle'
dict_array[1] = 'glasses'
dict_array[2] = 'truck'
dict_array[3] = 'Alicia'
dict_hash['shia-a'] = 'candle'
dict_hash['shaya'] = 'glasses'
M = 'land'
o = 'water'
world = [[o,o,o,o,o,o,o,o,o,o,o],
[o,o,o,o,M,M,o,o,o,o,o],
[o,o,o,o,o,o,o,o,M,M,o],
[o,o,o,M,o,o,o,o,o,M,o],
[o,o,o,M,o,M,M,o,o,o,o],
[o,o,o,o,M,M,M,M,o,o,o],
[o,M,M,M,M,M,M,M,M,M,o],
def translate_to_roman num
roman = ''
roman = roman + 'M' * (num / 1000)
if (num % 1000) >= 900
roman = roman + 'CM'
else
roman = roman + 'D' * (num % 1000 / 500)
KABUL, Afghanistan — The Afghan president and the Pakistani prime minister dismissed the WikiLeaks revelations about their respective countries as alternately false, unreliable and the work of “junior officers” in a joint news conference here on Saturday.
State’s Secrets
Articles in this series examine American diplomatic relations as a window on relations with the rest of the world in an age of war and terrorism.
Documents: Selected Dispatches
However, a senior Afghan minister later took a more aggrieved tone, suggesting that the leaked cables had irreparably damaged relations between the American ambassador, Karl W. Eikenberry, and members of the Afghan government. The minister, Omar Zakhilwal, also said that remarks attributed to him by Mr. Eikenberry in one of the cables, disparaging President Hamid Karzai, were false.
Until Saturday, the Afghan government had said little about the contents of the cables, thousands of confidential State Department memos that were made public in the past week by the We