Skip to content

Instantly share code, notes, and snippets.

View vaibhavgeek's full-sized avatar
🎯
Focusing

Vaibhav Maheshwari vaibhavgeek

🎯
Focusing
View GitHub Profile
@vaibhavgeek
vaibhavgeek / spinner.js
Last active September 17, 2018 12:35
Add this to application.js file to have loader in rails application. (Turbolinks and ajax both)
$( document ).ready(function() {
// hide spinner
$("#spinner").hide();
// show spinner on AJAX start
$(document).ajaxStart(function(){
$("#spinner").show();
@vaibhavgeek
vaibhavgeek / .js
Last active February 3, 2016 14:01
Aishwarya Jain Edit this.
<script type="text/javascript">
var Q = Quintus({development: false})
.include("Sprites, Scenes, Input, 2D, Anim, Touch, UI")
.setup("myGame")
.controls().touch()
var flag=0;//score
var l=1;// current level
var newscore=0;//
var disp=0;//diplay score
var comp=1,pflag=0;
from collections import Counter
from itertools import groupby
strs=raw_input()
count = 0
answer = ''
for k, g in groupby(strs):
count = len(list(g))
if (count > 1) and (k != ' '):
answer = answer + k + str(count)
else:
import json
import requests
from constants import SEND_MESSAGE_URL, PAT as token
from random import randint
import random
import math
def send_typing_status(recipient):
r = requests.post(SEND_MESSAGE_URL,
params={"access_token": token},
@vaibhavgeek
vaibhavgeek / sarang.py
Created August 14, 2016 05:57
Functions_to_be_Added.py
def quadeasy():
a = randint(1,7)
c = randint(1,40)
b = 2 * math.sqrt(a*c)
while(math.sqrt(a*c).is_integer() == False):
c = c+1
b = int(2 * math.sqrt(a*c))
answer = float(-1 * b )/(2*a)
question = "Solve the Equation %sx^2 + %sx + %s = 0" %(a ,b ,c )
return question
from random import randint
import random
import math
def quadeasy():
a = randint(1,7)
c = randint(1,40)
b = 2 * math.sqrt(a*c)
while(math.sqrt(a*c).is_integer() == False):
c = c+1
@vaibhavgeek
vaibhavgeek / util.py
Created August 14, 2016 09:05
HackInOut 3.0
import json
import requests
from constants import SEND_MESSAGE_URL, PAT as token
from random import randint
import random
import xml.etree.ElementTree
import math
def send_typing_status(recipient):
def advacned_operation():
dic_mult = easy_multiply()
dic_div = easy_divide()
dic_add = easy_addition()
dic_sub = easy_subtraction()
question = 'Solve the expression ( %s + %s ) + ( %s - %s ) + ( %s * %s ) + ( %s / %s )' %(dic_add["param1"], dic_add['param2'],dic_sub['param1'],dic_sub['param2'],dic_mult['param1'],dic_mult['param2'],dic_div['param1'],dic_div['param2'])
answer = int(dic_add['param1']) + int(dic_add['param2']) + int(dic_sub['param1']) - int(dic_sub['param2']) + ( int(dic_mult['param1']) * int(dic_mult['param2'])) + ( int(dic_div['param1'])/int(dic_div['param2']) )
option1 = answer + 3
option2 = answer + 5
# == Schema Information
#
# Table name: notewidgets
#
# id :integer not null, primary key
# note_id :integer
# tag_one :string question_text || content
# tag_two :string option1
# tag_three :string option2
# tag_four :string option3
<div class="col-md-8 col-md-offset-2 questions">
<div class="well">
<h3><%= @toload.tag_one %> </h3>
<ul class="list-group">
<label><li class="list-group-item" onclick = '$(".questions .active").removeClass("active");$(this).addClass("active");' ><%= radio_button_tag 'option', "option1" %> <%= @toload.tag_four %> </li> </label>
<label><li class="list-group-item" onclick = '$(".questions .active").removeClass("active");$(this).addClass("active");'><%= radio_button_tag 'option', "option2" %> <%= @toload.tag_five %></li></label>
<label><li class="list-group-item" onclick = '$(".questions .active").removeClass("active");$(this).addClass("active");'> <%= radio_button_tag 'option' , "option3" %> <%= @toload.tag_six %></li></label>
<label><li class="list-group-item" onclick = '$(".questions .active").removeClass("active");$(this).addClass("active");'> <%= radio_button_tag 'option' , "option4" %> <%= @toload.tag_seven %> </li></label>