Skip to content

Instantly share code, notes, and snippets.

View anjanaraveendra's full-sized avatar

Anjana anjanaraveendra

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 100px;
height: 100px;
border: 10px solid green;
padding: 25px;
margin: 25px;
#SurveyController Class
class Api::V1::SurveysController < Api::V1::BaseController
before_action :set_survey, only: [:show, :questions]
def index
# Api to get all current user schedules for the current time
@schedules = @account.schedules.includes(:survey, survey_version: :departments).joins(:survey)
.where(surveys: { status: 1 }, completed_at: nil).where(ignore: false)
.where('schedules.start_time <= :time AND schedules.buffer_time >= :time', time: Time.current)
.order('schedules.start_time asc')
<script>
var tempStr = "",prevNumber=1,i,depth=10;
for(i=0;i<depth;i++){
tempStr = "";j=0;
while(j<= i){
tempStr = tempStr + " " + prevNumber;
j++;
prevNumber++;
}
console.log(tempStr);
<script>
var a = prompt("Enter");
var f = 1;
for (var c = 1; c <= a; ++c) f *= c;
alert(f);
</script>
var i;
var fib = [];
fib[0] = 0;
fib[1] = 1;
for(i=2; i<=10; i++)
{
fib[i] = fib[i-2] + fib[i-1];
}
alert(fib);
<script>
var a = prompt("Enter Value");
b = a.toString();
rev = b.split("").reverse().join("");
if(a == rev)
{
alert("Palindrome");
}
else
{
<script>
var a=prompt("Enter a value");
if(a%2==0)
{
alert("Given number is even");
}
else {
alert("Give number is odd");
}
</script>
<script>
var a=prompt("Enter a value");
z=a;
e = d = 0;
while(z > 0)
{
e = z % 10;
d = d + fact(e);
z = parseInt(z/10);
}
<script>
var a=prompt("enter a value");
var count=0;
for(var i=2;i<a;i++)
{
if(a%i==0)
{
count=i;
}
<script>
var e,x,d=0;
var b=prompt("Enter a number");
x=b;
while(x>0)
{
e=x%10;
d=d+(e*e*e);
x=parseInt(x/10);
}