query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
MAIN MENU SUB PROFILE | def display_profile_options
puts "1. Back to Main Menu"
puts "2. Remove a Beer from My Interests"
puts "3. Refresh Page"
puts "4. Logout"
print_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nav_main(topic = \"main\")\n main = \"\"\n back = \"\"\n profile = \"[\" + \"\\#\".green + \"] View Profiles \"\n exit_cli = \"[\" + \"exit\".green + \"] Exit Program \"\n if topic != 'main'\n back = \"[\" + \"menu\".green + \"] Main Menu \" if top... | [
"0.68258536",
"0.67460877",
"0.6700859",
"0.650722",
"0.64213187",
"0.6280471",
"0.62683076",
"0.62311995",
"0.619744",
"0.61858714",
"0.61577296",
"0.61438626",
"0.61333454",
"0.61326206",
"0.61290604",
"0.6092275",
"0.6064746",
"0.6048305",
"0.6047068",
"0.6030769",
"0.6023... | 0.58774143 | 33 |
MAIN MENU SUB 1 | def prompt_sub_one
puts "1. New Search"
puts "2. Back to Main Menu"
print_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main()\n main_menu(SHOW_HEADER);\n end",
"def sub_menu\n puts \"\\n***********************************************\".colorize(:magenta).blink\n puts \"Type the following letters to do...\".colorize(:blue)\n puts \"-----------------------------------------------\".colorize(:cyan).bold\... | [
"0.7078838",
"0.70763487",
"0.70516163",
"0.6970304",
"0.69305265",
"0.6875889",
"0.67898166",
"0.6754016",
"0.67220366",
"0.6679244",
"0.6675464",
"0.66592926",
"0.66308796",
"0.6583507",
"0.65781564",
"0.6552656",
"0.6548033",
"0.65329564",
"0.652045",
"0.6450339",
"0.64301... | 0.0 | -1 |
MAIN MENU SUB 11 | def prompt_sub_1_1_search
print_line
puts "Please Enter Search Query:"
print_line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\n... | [
"0.7307953",
"0.71606725",
"0.70834875",
"0.70740604",
"0.70509964",
"0.7042365",
"0.7029924",
"0.69771636",
"0.68581223",
"0.6799567",
"0.67688185",
"0.6731339",
"0.67113525",
"0.667574",
"0.66510224",
"0.66173553",
"0.6612916",
"0.66068214",
"0.66034955",
"0.65852255",
"0.6... | 0.0 | -1 |
MAIN MENU SUB 21 | def user_stats_header
puts "My Stats"
line_break
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\n... | [
"0.7417538",
"0.72860456",
"0.7181588",
"0.71137315",
"0.7107278",
"0.7035883",
"0.70126736",
"0.69557035",
"0.692822",
"0.67785347",
"0.6764625",
"0.6720514",
"0.6717493",
"0.6638011",
"0.66245",
"0.66058564",
"0.6599095",
"0.65947485",
"0.65723926",
"0.65701467",
"0.6549347... | 0.0 | -1 |
listing all animals currently in shelter | def list_animals
puts "Here are the current animals in shelter: "
@animals_in_shelter.each do |animal|
puts animal.get_animal_info
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_all_animals(shelter)\n\n if shelter.animals.any?\n puts \"*** List of all animals ***\"\n shelter.animals.each do |key, x|\n puts \"Name: #{x.name}, Breed: #{x.breed}, Gender: #{x.gender}, Age: #{x.age}, Toys: #{x.toys.join(', ')}, Adoption: #{x.adoption}\"\n end\n else\n puts \"We have... | [
"0.7623735",
"0.723639",
"0.6934487",
"0.6831511",
"0.6737274",
"0.6706811",
"0.6560124",
"0.6542465",
"0.6529723",
"0.6493381",
"0.64846635",
"0.64819205",
"0.6429586",
"0.6407781",
"0.6362401",
"0.62835073",
"0.6274803",
"0.62569624",
"0.6208785",
"0.6191216",
"0.6153456",
... | 0.8338322 | 0 |
adding new animal to shelter | def add_animal(animal)
puts "Animal added to shelter: #{animal.get_animal_info}"
@animals_in_shelter.push(animal)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_animal\n species = get_answer_to(\"What is the species?\")\n name = get_answer_to(\"What is the animal\\'s name?\")\n animal = Animals.new(name, species)\n @animals << animal\n end",
"def add_animal(new_animal)\n output_strings = []\n\n # add a... | [
"0.75432557",
"0.71951246",
"0.7174103",
"0.7093694",
"0.7038688",
"0.6964591",
"0.69612527",
"0.6924712",
"0.68881756",
"0.6871566",
"0.6815679",
"0.6702667",
"0.6686723",
"0.66761625",
"0.66618",
"0.6651841",
"0.6645949",
"0.66144353",
"0.6613487",
"0.66080153",
"0.66008663... | 0.87673944 | 0 |
adopting animal from shelter | def adopt_animal(name)
@animals_in_shelter.each_with_index do |animal, i|
if name == animal.get_animal_name
puts "#{name} has been adopted!"
@animals_in_shelter.delete_at(i)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adopt_pet_from_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets + 1\n @pets[animal_name] = animal_instance_name\n shelter_instance_name.animals.delete(animal_name)\n end",
"def give_pet_up_to_shelter(animal_name, animal_instance_name, shelter_ins... | [
"0.75329214",
"0.7177913",
"0.6383488",
"0.63060004",
"0.6286912",
"0.62837917",
"0.60566294",
"0.6022436",
"0.59864265",
"0.5887213",
"0.5849007",
"0.5836315",
"0.5804347",
"0.57516044",
"0.5750267",
"0.57332265",
"0.56880003",
"0.56856674",
"0.5661196",
"0.56493425",
"0.562... | 0.6707998 | 2 |
GET /redactions GET /redactions.json | def index
@redaction = Redaction.all.order('id DESC').paginate(page: params[:page], per_page: 50)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @redactions = Redaction.all\n end",
"def redactions(options = {})\r\n []\r\n end",
"def index\n @remedy_actions = RemedyAction.all\n end",
"def set_redaction\n @redaction = Redaction.find(params[:id])\n end",
"def set_redaction\n @redaction = Redaction.find(params[:id])... | [
"0.7202297",
"0.61949617",
"0.5980639",
"0.58778965",
"0.58778965",
"0.58481085",
"0.58251786",
"0.58146876",
"0.58146876",
"0.58027613",
"0.58027613",
"0.5789534",
"0.57740736",
"0.57740736",
"0.577105",
"0.577024",
"0.5743215",
"0.56627387",
"0.5620643",
"0.55705196",
"0.55... | 0.62964946 | 1 |
POST /redactions POST /redactions.json | def create
@redaction = Redaction.new(redaction_params)
respond_to do |format|
if @redaction.save
format.html { redirect_to @redaction, notice: 'Redaction was successfully created.' }
format.json { render :show, status: :created, location: @redaction }
else
format.html { render :new }
format.json { render json: @redaction.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @red = Red.new(red_params)\n\n respond_to do |format|\n if @red.save\n format.html { redirect_to request.referrer, notice: 'Red was successfully created.' }\n format.json { render :show, status: :created, location: @red }\n else\n format.html { render :new }\n ... | [
"0.60335094",
"0.59971386",
"0.5819923",
"0.5814738",
"0.5764917",
"0.5764917",
"0.57573676",
"0.56865317",
"0.56438875",
"0.56438875",
"0.5592745",
"0.55274516",
"0.54872566",
"0.5411561",
"0.53970075",
"0.5388228",
"0.53530157",
"0.53185326",
"0.5306967",
"0.53051996",
"0.5... | 0.6994867 | 1 |
DELETE /redactions/1 DELETE /redactions/1.json | def destroy
@redaction.destroy
respond_to do |format|
format.html { redirect_to redactions_url, notice: 'Redaction was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"de... | [
"0.7249294",
"0.7062414",
"0.70323956",
"0.6812912",
"0.6772958",
"0.67714584",
"0.6768948",
"0.6742741",
"0.6714622",
"0.6703166",
"0.6663673",
"0.66016185",
"0.65748864",
"0.65748864",
"0.6569586",
"0.6568313",
"0.6526383",
"0.6521479",
"0.6521135",
"0.6507915",
"0.65010977... | 0.7244685 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_redaction
@redaction = Redaction.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def redaction_params
params.require(:redaction).permit(:picture, :howreceive, :redaction_title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Service entry point return valid user object | def call
{
user: user,
email: decoded_auth_token['email'],
orgnaization_id: decoded_auth_token['orgnaization_id'],
slug: decoded_auth_token['slug']
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_user(params)\n return @user unless @user.nil?\n\n if params && !params.empty?\n return User.find_by_authentication_code( params )\n else\n return nil\n end\n end",
"def validate_user\n\n cache_data = CacheManagement::User.new([@user_id]).fetch\n @user = cache_data[@user... | [
"0.744572",
"0.7437992",
"0.73741215",
"0.72116935",
"0.7151924",
"0.71000254",
"0.70625865",
"0.6977934",
"0.69714737",
"0.69445074",
"0.69377977",
"0.69258875",
"0.68736076",
"0.68653464",
"0.6830944",
"0.68221635",
"0.6803737",
"0.6787508",
"0.67854357",
"0.67505276",
"0.6... | 0.0 | -1 |
check for auth_token in `Authorization` header | def auth_token
return token if token.present?
false
# raise(CustomException::MissingToken, 'token is missing')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_header\n !request.env[\"HTTP_X_ACCESS_TOKEN\"].nil?\n end",
"def verify_header\n # normal header like sample ==> Authorization 'ddd$$%gggrghHFDSS.HHJHTTGGR'\n if headers['Authorization'].present?\n headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Toke... | [
"0.79746443",
"0.79694754",
"0.7940858",
"0.7635687",
"0.7632873",
"0.7598262",
"0.7575235",
"0.7573791",
"0.7552934",
"0.7550838",
"0.7508105",
"0.7466674",
"0.7423157",
"0.74049574",
"0.7364954",
"0.73642355",
"0.7359021",
"0.72880846",
"0.72861594",
"0.72799575",
"0.727139... | 0.70048237 | 46 |
added for backwards compatibility with older versions of inifile | def file_path
self.class.file_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_file(filename); end",
"def parse_input (input_file)\nend",
"def file_utils; end",
"def inname\n if self.proper_infilename.nil?\n return self.infile_name\n else\n return self.proper_infilename\n end\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
... | [
"0.7031829",
"0.61382467",
"0.611234",
"0.6064603",
"0.60588384",
"0.60588384",
"0.60285604",
"0.5982483",
"0.59131825",
"0.58849746",
"0.5876557",
"0.5873445",
"0.5839121",
"0.5839121",
"0.58116585",
"0.58116585",
"0.58116585",
"0.58116585",
"0.58116585",
"0.58116585",
"0.58... | 0.0 | -1 |
Override the directory where uploaded files will be stored. | def store_dir
"flashcard777/flashcard777/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n 'uploads'\n end",
"def store_dir\n \"uploads\"\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n \"uploads/\"\n ... | [
"0.7992477",
"0.7737353",
"0.7732477",
"0.7637168",
"0.75621146",
"0.75621146",
"0.75621146",
"0.74223",
"0.73538774",
"0.7319404",
"0.731887",
"0.7304938",
"0.7282087",
"0.72789246",
"0.7272874",
"0.7265028",
"0.72640795",
"0.7233383",
"0.7220581",
"0.72188616",
"0.72019714"... | 0.0 | -1 |
creating an array to store songs created | def initialize(name)
@name = name
@songs = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def initialize\n\t\t@songs = Array.new\n\tend",
"def initialize\n @songs = []\n end",
"def initialize\n super\n @songs = []\n end",
"def initialize\n super\n @songs = []\n end",
"def add_song(son... | [
"0.7599973",
"0.7599973",
"0.7581471",
"0.75659794",
"0.72871",
"0.72871",
"0.7215216",
"0.7194749",
"0.7161651",
"0.7153298",
"0.71460384",
"0.70769423",
"0.707428",
"0.7069525",
"0.7042947",
"0.7035651",
"0.7035651",
"0.7017516",
"0.70081663",
"0.6981768",
"0.6976326",
"0... | 0.66732556 | 73 |
Encodes a request msg | def encoderequest(sender, target, msg, requestid, filter={}, target_agent=nil, target_collective=nil)
serialized = Marshal.dump(msg)
digest = makehash(serialized)
req = create_request(requestid, target, filter, serialized, @initiated_by, target_agent, target_collective)
req[:hash] = digest
Marshal.dump(req)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoderequest(sender, target, msg, requestid, filter={})\n serialized = Marshal.dump(msg)\n digest = makehash(serialized)\n \n @log.debug(\"Encoding a request for '#{target}' with request id #{requestid}\")\n request = {:body => serialized,\n ... | [
"0.655947",
"0.6424981",
"0.63148844",
"0.6269933",
"0.62282616",
"0.6210985",
"0.61449206",
"0.6130633",
"0.6104965",
"0.60915184",
"0.6008699",
"0.5921019",
"0.58890426",
"0.5834426",
"0.579513",
"0.57921994",
"0.57860625",
"0.5757325",
"0.57281667",
"0.5721147",
"0.5718193... | 0.61697453 | 6 |
Checks the md5 hash in the request body against our psk, the request sent for validation should not have been deserialized already | def validrequest?(req)
Log.info "Caller id: #{req[:callerid]}"
Log.info "Sender id: #{req[:senderid]}"
message = req[:body]
#@log.info req.awesome_inspect
identity = (req[:callerid] or req[:senderid])
verifier = SSH::Key::Verifier.new(identity)
Log.info "Using name '#{identity}'"
# If no callerid, this is a 'response' message and we should
# attempt to authenticate using the senderid (hostname, usually)
# and that ssh key in known_hosts.
if !req[:callerid]
# Search known_hosts for the senderid hostname
verifier.add_key_from_host(identity)
verifier.use_agent = false
verifier.use_authorized_keys = false
end
signatures = Marshal.load(req[:hash])
if verifier.verify?(signatures, req[:body])
@stats.validated
return true
else
@stats.unvalidated
raise(SecurityValidationFailed, "Received an invalid signature in message")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n return false unless @digest_parts.any? # RUBY\n\n a2 = @request.method + ':' + @digest_parts['uri']\n\n if @digest_parts['qop'] == 'auth-int'\n # Making sure we support this qop value\n return false unless @qop & QOP_AUTHINT\n\n # We need t... | [
"0.7140919",
"0.67846555",
"0.6614199",
"0.6251338",
"0.61787",
"0.6146564",
"0.60464036",
"0.60281795",
"0.5989374",
"0.59876317",
"0.59870374",
"0.59769547",
"0.59695894",
"0.5955319",
"0.59323215",
"0.5924838",
"0.5903066",
"0.57813275",
"0.57412064",
"0.5728396",
"0.56826... | 0.59036195 | 16 |
Signs a message. If 'public.sshkey' is set, then we will sign with only that key. Otherwise, we will sign with your sshagente. | def makehash(body)
signer = SSH::Key::Signer.new
if @config.pluginconf["sshkey"]
signer.add_key_file(@config.pluginconf["sshkey"])
signer.use_agent = false
end
signatures = signer.sign(body).collect { |s| s.signature }
return Marshal.dump(signatures)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(message)\n Ed25519.provider.sign(@keypair, message)\n end",
"def sign(message); end",
"def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end",
"def sign(message)\n OpenSSL::HMAC.digest('SHA256', @key, message)\n ... | [
"0.69905317",
"0.6878072",
"0.6772801",
"0.64663434",
"0.6460009",
"0.6244644",
"0.6233207",
"0.62019277",
"0.61878014",
"0.6138916",
"0.60511136",
"0.60146034",
"0.59577733",
"0.59250337",
"0.5899591",
"0.5859341",
"0.5803851",
"0.5797215",
"0.5744226",
"0.56867135",
"0.5681... | 0.5456617 | 38 |
GET /assignments GET /assignments.json | def index
redirect_to course_path @course #Easiest to put things in one place
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@assignments = Assignment.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @assignments }\n\t\tend\n\tend",
"def index\n render json: { assignments: [ @assignment.as_json ] }\n end",
"def index\n @assignments = Assignment.all\n e... | [
"0.742175",
"0.7402341",
"0.7262853",
"0.7262853",
"0.7262853",
"0.7262853",
"0.7233654",
"0.7213074",
"0.7161295",
"0.7135652",
"0.70959735",
"0.7018067",
"0.7017317",
"0.6912195",
"0.6847285",
"0.6798713",
"0.6783859",
"0.6739282",
"0.6734983",
"0.6719285",
"0.6698327",
"... | 0.0 | -1 |
GET /assignments/1 GET /assignments/1.json | def show
if user_signed_in?
@trigger = TriggerAction.pending_action("review_required", current_user, @assignment)
@my_answers = Answer.where(user: current_user, assignment: @assignment, active: true)
@my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id)
if current_user.get_and_store_experimental_condition!(@assignment.course) == "batched_email"
@my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id).where('created_at < ?', 1.day.ago)
end
@reviews_by_me = Review.where(active: true, assignment_id: @assignment.id).where("user_id = ? or copilot_email = ?", current_user.id,current_user.email)
@out_of_box_answers_with_count = Review.where(assignment_id: @assignment.id, out_of_box_answer: true).group(:answer_id).count
unless @out_of_box_answers_with_count.blank?
@out_of_box_answers = @out_of_box_answers_with_count.reject {|k,v| v < 2 }
end
if @out_of_box_answers.blank?
@out_of_box_answers = {}
end
end
@all_answers = @assignment.answers.reviewable.limit(10)
@starred_answers = @assignment.answers.reviewable.where(starred: true)
render layout: "one_column"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render json: { assignments: [ @assignment.as_json ] }\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"def index\n @assignments = Assignment.all\n end",
"de... | [
"0.712585",
"0.7047258",
"0.7047258",
"0.7047258",
"0.7047258",
"0.7026103",
"0.70218605",
"0.69764155",
"0.69756424",
"0.696039",
"0.696039",
"0.696039",
"0.6929115",
"0.6806007",
"0.6780801",
"0.67684746",
"0.67525375",
"0.67498857",
"0.6740297",
"0.67289686",
"0.6728486",
... | 0.0 | -1 |
POST /assignments POST /assignments.json | def create
# raise params.inspect
@assignment = Assignment.new(assignment_params)
@assignment.course = Course.find(params[:course_id])
@assignment.user=current_user
respond_to do |format|
if @assignment.save
format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }
format.json { render action: 'show', status: :created, location: @assignment }
else
format.html { render action: 'new' }
format.json { render json: @assignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\... | [
"0.69719887",
"0.6878845",
"0.68722147",
"0.6866222",
"0.68636656",
"0.68479973",
"0.68240887",
"0.6803592",
"0.6741433",
"0.6729679",
"0.6649603",
"0.6641474",
"0.660345",
"0.6590609",
"0.6520075",
"0.648458",
"0.6479206",
"0.64735156",
"0.6472296",
"0.6467634",
"0.64431983"... | 0.6078574 | 53 |
PATCH/PUT /assignments/1 PATCH/PUT /assignments/1.json | def update
# raise assignment_params.inspect
respond_to do |format|
if @assignment.update(assignment_params)
format.html { redirect_to @assignment, notice: 'Assignment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @assignment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @assignment = Assignment.find(params[:id])\n\n respond_to do |format|\n if @assignment.update_attributes(params[:assignment])\n format.html { redirect_to @assignment, :notice => 'Assignment was successfully updated.' }\n format.json { head :ok }\n else\n format.htm... | [
"0.6841301",
"0.6816695",
"0.677991",
"0.677991",
"0.6764407",
"0.67518985",
"0.6637946",
"0.65174943",
"0.65174943",
"0.65174943",
"0.65174943",
"0.65174943",
"0.6503887",
"0.64987713",
"0.6464981",
"0.64307606",
"0.63736784",
"0.635448",
"0.6343713",
"0.6337919",
"0.6336949... | 0.66337556 | 7 |
DELETE /assignments/1 DELETE /assignments/1.json | def destroy
@course = @assignment.course
@assignment.destroy
respond_to do |format|
format.html { redirect_to course_assignments_url(@course) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to assignments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n resp... | [
"0.7463973",
"0.74596244",
"0.74596244",
"0.74497867",
"0.7383841",
"0.73820657",
"0.7366589",
"0.7366589",
"0.7360303",
"0.72292906",
"0.7200546",
"0.7143282",
"0.7112441",
"0.71040916",
"0.71015066",
"0.70903736",
"0.7065261",
"0.7049506",
"0.7049506",
"0.7049506",
"0.70495... | 0.6952718 | 29 |
Use callbacks to share common setup or constraints between actions. | def set_assignment
@assignment = Assignment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def assignment_params
params.permit(:course_id)
params.permit(:grade_id)
params.permit(:assignment_grade => [:credit])
params.permit(:recent_review)
params.permit(:page)
params.require(:assignment).permit(:title, :description, :template, :example, :milestone_list, :due_at, :open_at,
:review_due_at,
:rubric_items_attributes=>[
:id, :title, :short_title, :show_for_feedback, :show_for_final,
:like_feedback_prompt,
:_destroy, :answer_attributes_attributes=>[:id, :description, :score, :attribute_type, :example, :_destroy]], :taggings_attributes=>[:id, :open_at, :close_at, :review_open_at, :review_close_at]) #don't allow user id. set to current user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /users/:user_id/xemojis GET /users/:user_id/xemojis.json | def index
@xemojis = XemojisForUserService.new({user: @user}).call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape_emoji_page(url)\n body = @agent.get(clean_url(url)).body\n { unicode: body.scan(/U\\+[\\w\\d]{4,6}/),\n shortcodes: body.scan(/\\:[\\w\\_\\-\\d]+:/) }\n end",
"def get_twitch_emoticons\n # Get Emoticons for Channel\n headers = {\n 'Accept' => 'application/vnd.twitchtv.v3+json',\... | [
"0.59091413",
"0.58683527",
"0.5760412",
"0.56899124",
"0.5521206",
"0.5507339",
"0.54718137",
"0.53935355",
"0.533379",
"0.5317179",
"0.5302984",
"0.52921474",
"0.5285064",
"0.52808297",
"0.526442",
"0.52467793",
"0.52236485",
"0.52196753",
"0.52190584",
"0.52190584",
"0.521... | 0.8067735 | 0 |
GET /users/:user_id/xemojis/1 GET /users/:user_id/xemojis/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @xemojis = XemojisForUserService.new({user: @user}).call\n end",
"def scrape_emoji_page(url)\n body = @agent.get(clean_url(url)).body\n { unicode: body.scan(/U\\+[\\w\\d]{4,6}/),\n shortcodes: body.scan(/\\:[\\w\\_\\-\\d]+:/) }\n end",
"def draw_emoji(x, y, xx, width, char, mh, tes... | [
"0.7907821",
"0.5919946",
"0.58895844",
"0.575476",
"0.573245",
"0.5599263",
"0.5540453",
"0.55203485",
"0.5504964",
"0.54904556",
"0.54576653",
"0.5426684",
"0.5389433",
"0.53848594",
"0.5377163",
"0.53453755",
"0.5334984",
"0.5323004",
"0.5306681",
"0.5286635",
"0.52537555"... | 0.0 | -1 |
POST /users/:user_id/xemojis POST /users/:user_id/xemojis.json | def create
redirect_to :action => 'not_implemented', :status => 501
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @xemojis = XemojisForUserService.new({user: @user}).call\n end",
"def add_emoji(auth, server_id, image, name, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_emojis,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/... | [
"0.74396235",
"0.5825977",
"0.56542784",
"0.55830085",
"0.5485322",
"0.52858204",
"0.52801895",
"0.52451915",
"0.5080152",
"0.50624985",
"0.5054054",
"0.49850875",
"0.49773395",
"0.49160987",
"0.4871773",
"0.48699182",
"0.48347747",
"0.48191956",
"0.48074126",
"0.4802297",
"0... | 0.0 | -1 |
PATCH/PUT /users/:user_id/xemojis/1 PATCH/PUT /users/:user_id/xemojis/1.json | def update
redirect_to :action => 'not_implemented', :status => 501
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_emoji(auth, server_id, emoji_id, name, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_emojis_eid,\n server_id,\n :patch,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/emojis/#{emoji_id}\",\n { name: name }.to_json,\n Authorizatio... | [
"0.7188895",
"0.64769787",
"0.6072823",
"0.60359484",
"0.60359484",
"0.5811964",
"0.57804406",
"0.57804406",
"0.5661042",
"0.5487526",
"0.5390447",
"0.52771485",
"0.52512133",
"0.5218494",
"0.5218444",
"0.51894855",
"0.5160666",
"0.5155478",
"0.509985",
"0.5098913",
"0.508341... | 0.0 | -1 |
DELETE /users/:user_id/xemojis/1 DELETE /users/:user_id/xemojis/1.json | def destroy
redirect_to :action => 'not_implemented', :status => 501
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_emoji(auth, server_id, emoji_id, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_emojis_eid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/emojis/#{emoji_id}\",\n Authorization: auth,\n 'X-Audit-Log-Reaso... | [
"0.7124477",
"0.680654",
"0.65564674",
"0.6537442",
"0.6502893",
"0.6443",
"0.64262074",
"0.6415083",
"0.6406632",
"0.6380994",
"0.63372594",
"0.6323784",
"0.6313672",
"0.6264809",
"0.62405664",
"0.6228518",
"0.6224238",
"0.6223252",
"0.61866254",
"0.6178145",
"0.617338",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:user_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Returns an input string after it's been put through the aliases | def alias_input_pass(input)
# Each entry is formatted [/Alias match regex/, "Alias Name", /gsub replacement regex/, "replace with string"]
alias_input_map = [
[/\b\d+dF\b/i, 'Fudge', /\b(\d+)dF\b/i, '\\1d3 f1 t3'], # Fate fudge dice
[/\bSNM\d+\b/i, 'Sunsails', /\bSNM(\d+)\b/i, '\\1d6 ie6 t4'], # Sunsails: New Milennium; Fourth Edition
[/\b\d+wh\d+\+/i, 'Warhammer', /\b(\d+)wh(\d+)\+/i, '\\1d6 t\\2'], # Warhammer (AoS/40k)
[/\b\d+WoD\d+\b/i, 'WoD', /\b(\d+)WoD(\d+)\b/i, '\\1d10 f1 t\\2'], # World of Darkness 4th edition (note: explosions are left off for now)
[/\bdd\d\d\b/i, 'Double Digit', /\bdd(\d)(\d)\b/i, '(1d\\1 * 10) + 1d\\2'], # Rolling one dice for each digit
[/\bage\b/i, 'AGE System Test', /\b(age)\b/i, '2d6 + 1d6'], # 2d6 plus one drama/dragon/stunt die
[/\B\+d\d+\b/i, 'Advantage', /\B\+d(\d+)\b/i, '2d\\1 d1'], # Roll two dice of the specified size and keep the highest
[/\B-d\d+\b/i, 'Disadvantage', /\B-d(\d+)\b/i, '2d\\1 kl1'], # Roll two dice of the specified size and keep the lowest
[/\B\+d%\B/i, 'Advantage on percentile', /\B\+d%\B/i, '((2d10kl1-1) *10) + 1d10'], # Roll two d10s for the tens column and keep the lowest (roll under system) then add a d10 for the ones
[/\B-d%\B/i, 'Disadvantage on percentile', /\B-d%\B/i, '((2d10k1-1) *10) + 1d10'], # Roll two d10s for the tens column and keep the highest (roll under system) then add a d10 for the ones
[/\b\d+CoD\b/i, 'CoD 10-again', /\b(\d+)CoD\b/i, '\\1d10 ie10 t8'], # Chronicles of Darkness (default, 10-again)
[/\b\d+CoD8\b/i, 'CoD 8-again', /\b(\d+)CoD8\b/i, '\\1d10 ie9 t8'], # Chronicles of Darkness (8-again)
[/\b\d+CoD9\b/i, 'CoD 9-again', /\b(\d+)CoD9\b/i, '\\1d10 ie8 t8'], # Chronicles of Darkness (9-again)
[/\b\d+CoDR\b/i, 'CoD rote quality', /\b(\d+)CoDR\b/i, '\\1d10 r7 t8'], # Chronicles of Darkness (Rote quality, reroll all failed)
[/\bd6s\d+\b/i, 'The D6 System', /\bd6s(\d+)\b/i, '\\1d6 + 1d6 ie'], # The D6 System
[/\bsr\d+\b/i, 'Shadowrun', /\bsr(\d+)\b/i, '\\1d6 t5'], # Shadowrun system
[/\b\d+d%\B/i, 'Percentile roll', /\b(\d+)d%\B/i, '\\1d100'], # Roll a d100
[/\bsp\d+\b/i, 'Storypath', /\bsp(\d+)\b/i, 'ul \\1d10 ie10 t8'], # storypath system
[/\b\d+yz\b/i, 'Year Zero', /\b(\d+)yz\b/i, '\\1d6 t6'], # year zero system
[/\bdndstats\b/i, 'DnD Stat-roll', /\b(dndstats)\b/i, '6 4d6 k3'] # DnD character stats - 4d6 drop lowest 6 times
]
@alias_types = []
new_input = input
# Run through all aliases and record which ones we use
alias_input_map.each do |alias_entry|
if input.match?(alias_entry[0])
@alias_types.append(alias_entry[1])
new_input.gsub!(alias_entry[2], alias_entry[3])
end
end
new_input
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\... | [
"0.72118866",
"0.7194395",
"0.71502584",
"0.70598966",
"0.7031325",
"0.7022299",
"0.70205754",
"0.69543993",
"0.6918011",
"0.6856056",
"0.6849718",
"0.6848692",
"0.68214875",
"0.6766864",
"0.6747798",
"0.6746079",
"0.67219716",
"0.6708574",
"0.66849214",
"0.66691124",
"0.6659... | 0.63608056 | 34 |
Returns dice string after it's been put through the aliases | def alias_output_pass(roll_tally)
# Each entry is formatted "Alias Name":[[]/gsub replacement regex/, "replace with string", etc]
# Not all aliases will have an output hash
alias_output_hash = {
'Fudge' => [[/\b1\b/, '-'], [/\b2\b/, ' '], [/\b3\b/, '+']]
}
new_tally = roll_tally
@alias_types.each do |alias_type|
next unless alias_output_hash.has_key?(alias_type)
alias_output = alias_output_hash[alias_type]
alias_output.each do |replacement|
new_tally.gsub!(replacement[0], replacement[1])
end
end
new_tally
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_alias\n 12.times.map { (SecureRandom.random_number(26) + 97).chr }.join\n end",
"def to_s( )\n\t\t\t\"#{@dice[0..-2].join(',')} and #{@dice[-1]}\"\n\t\tend",
"def spy_alias1 full_name\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n vowels=['a','e','i','o','u']\... | [
"0.62408054",
"0.60986745",
"0.6031919",
"0.60224485",
"0.59543765",
"0.59313226",
"0.589812",
"0.5848641",
"0.58262503",
"0.5806883",
"0.5749238",
"0.57378244",
"0.5732169",
"0.5672092",
"0.56484675",
"0.5642962",
"0.5627511",
"0.560511",
"0.5600599",
"0.5553079",
"0.552579"... | 0.59135455 | 6 |
Takes raw input and returns a reverse polish notation queue of operators and Integers | def convert_input_to_rpn_queue(event, input)
split_input = input.scan(%r{\b(?:\d+d\d+(?:\s?[a-z]+\d+|\s?e+\d*|\s?[ie]+\d*)*)|[+\-*/]|(?:\b\d+\b)|[()]}i) # This is the tokenization string for our input
# change to read left to right order
input_queue = []
input_queue.push(split_input.pop) while split_input.length > 0
operator_priority = {
'+' => 1,
'-' => 1,
'*' => 2,
'/' => 2
}
output_queue = []
operator_stack = []
# Use the shunting yard algorithm to get our order of operations right
while input_queue.length > 0
input_queue_peek = input_queue.last
if input_queue_peek.match?(/\b\d+\b/) # If constant in string form
output_queue.prepend(Integer(input_queue.pop))
elsif input_queue_peek.match?(/\b\d+d\w+/i) # If dice roll
output_queue.prepend(process_roll_token(event, input_queue.pop))
elsif input_queue_peek.match?(%r{[+\-*/]})
# If the peeked operator is not higher priority than the top of the stack, pop the stack operator down
if operator_stack.length == 0 || operator_stack.last == '(' || operator_priority[input_queue_peek] > operator_priority[operator_stack.last]
operator_stack.push(input_queue.pop)
else
output_queue.prepend(operator_stack.pop)
operator_stack.push(input_queue.pop)
end
elsif input_queue_peek == '('
operator_stack.push(input_queue.pop)
elsif input_queue_peek == ')'
while operator_stack.last != '('
output_queue.prepend(operator_stack.pop)
raise "Extra ')' found!" if operator_stack.length == 0
end
operator_stack.pop # Dispose of the closed "("
input_queue.pop # Dispose of the closing ")"
else
raise "Invalid token! (#{input_queue_peek})"
end
end
while operator_stack.length > 0
raise "Extra '(' found!" if operator_stack.last == '('
output_queue.prepend(operator_stack.pop)
end
output_queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_rpn_token_queue(input_queue)\n output_stack = []\n\n while input_queue.length > 0\n input_queue_peek = input_queue.last\n\n if input_queue_peek.is_a?(Integer)\n output_stack.push(input_queue.pop)\n\n else # Must be an operator\n raise input_queue.pop + ' is not between two numbers!... | [
"0.6617116",
"0.6298454",
"0.62494934",
"0.6237868",
"0.6205052",
"0.6199971",
"0.6113251",
"0.610077",
"0.60413843",
"0.5978285",
"0.5971562",
"0.59494454",
"0.5932642",
"0.59130585",
"0.59071696",
"0.58635783",
"0.5860098",
"0.58552516",
"0.5846615",
"0.58230674",
"0.576391... | 0.6781429 | 0 |
Process a stack of tokens in reverse polish notation completely and return the result | def process_rpn_token_queue(input_queue)
output_stack = []
while input_queue.length > 0
input_queue_peek = input_queue.last
if input_queue_peek.is_a?(Integer)
output_stack.push(input_queue.pop)
else # Must be an operator
raise input_queue.pop + ' is not between two numbers!' if output_stack.length < 2
operator = input_queue.pop
operand_b = output_stack.pop
operand_a = output_stack.pop
output_stack.push(process_operator_token(operator, operand_a, operand_b))
end
end
raise 'Extra numbers detected!' if output_stack.length > 1
output_stack[0] # There can be only one!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_postfix tokens\n tokens.each do |token|\n if token.is_a? Integer\n @post_fix_expression << token\n elsif token == \"(\"\n @operator_stack << token\n elsif token.match(/[\\*\\/\\+\\-]/)\n while @operator_stack.last && @operator_stack.last.match(/[\\*\\/\\+\\-]/)... | [
"0.67364323",
"0.639874",
"0.6363061",
"0.6301344",
"0.62763315",
"0.6194754",
"0.6186308",
"0.61691254",
"0.61247736",
"0.6091007",
"0.60032964",
"0.59723043",
"0.59411067",
"0.5926385",
"0.5894983",
"0.58641714",
"0.5819866",
"0.5808848",
"0.5773469",
"0.57693523",
"0.57519... | 0.5864863 | 15 |
Takes a operator token (e.g. '+') and return the result of the operation on the given operands | def process_operator_token(token, operand_a, operand_b)
if token == '+'
operand_a + operand_b
elsif token == '-'
operand_a - operand_b
elsif token == '*'
operand_a * operand_b
elsif token == '/'
raise 'Tried to divide by zero!' if operand_b == 0
operand_a / operand_b
else
raise "Invalid Operator: #{token}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_operator token\n ##\n # We need two operands to perform an operation, so we \n # raise `InvalidTokenError` if we don't have those \n # (as at that moment of execution operator-tokens are invalid).\n raise InvalidTokenError if @stack.length < 2\n arg2 = pop!\n arg1 = pop!\n res = ge... | [
"0.83102626",
"0.7394833",
"0.7358377",
"0.7324891",
"0.72916377",
"0.7288666",
"0.7259138",
"0.72266454",
"0.72123647",
"0.71408975",
"0.7093812",
"0.7065005",
"0.7044905",
"0.702743",
"0.69931936",
"0.69790673",
"0.69708884",
"0.6968326",
"0.6948321",
"0.69324976",
"0.69323... | 0.81397116 | 1 |
Takes a roll token, appends the roll results, and returns the total | def process_roll_token(_event, token)
begin
dice_roll = DiceBag::Roll.new(token + @dice_modifiers)
# Rescue on bad dice roll syntax
rescue Exception => e
raise 'Roller encountered error with "' + token + @dice_modifiers + '": ' + e.message
end
token_total = dice_roll.result.total
# Check for reroll or indefinite reroll
reroll_check = dice_roll.result.sections[0].options[:reroll]
reroll_indefinite_check = dice_roll.result.sections[0].options[:reroll_indefinite]
if reroll_check > 0 || reroll_indefinite_check > 0
@reroll_count = dice_roll.result.sections[0].reroll_count
@show_rerolls = true
else
@show_rerolls = false
end
# Parse the roll and grab the total tally
parse_roll = dice_roll.tree
parsed = parse_roll.inspect
roll_tally = parsed.scan(/tally=\[.*?, @/)
roll_tally = String(roll_tally)
roll_tally.gsub!(/\[*("tally=)|"\]|"|, @/, '')
roll_tally.gsub!(/\[\[/, '[')
roll_tally.gsub!(/\]\]/, ']')
if @do_tally_shuffle == true
roll_tally.gsub!('[', '')
roll_tally_array = roll_tally.split(', ').map(&:to_i)
roll_tally = roll_tally_array.shuffle!
roll_tally = String(roll_tally)
end
@tally += roll_tally
token_total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total\n roll_all.reduce(&:+)\n end",
"def sum roll\n roll.reduce &:+\n end",
"def apply_roll_to_total(roll_reason, roll_result)\n case roll_reason\n when :basic, :reroll_new_die, :reroll_new_keeper, :reroll_replace\n @total = roll_result\n when :reroll_add\n @total ... | [
"0.73488116",
"0.6805841",
"0.67704463",
"0.66526693",
"0.644771",
"0.64475363",
"0.6181173",
"0.6139325",
"0.6105927",
"0.60964596",
"0.6076455",
"0.60742",
"0.6069119",
"0.6041715",
"0.5756544",
"0.5678213",
"0.5678213",
"0.56752324",
"0.5667398",
"0.56579214",
"0.5646743",... | 0.69327235 | 1 |
[/\bdndstats\b/i, 'DnD Statroll', /\b(dndstats)\b/i, '6 4d6 k3'] DnD character stats 4d6 drop lowest 6 times | def check_purge(event)
if @check =~ /^\s*(purge)\s*\d*$/i
@roll.slice! 'purge'
amount = @input.to_i
if (amount < 2) || (amount > 100)
event.respond(content: 'Amount must be between 2-100')
return false
end
if event.user.defined_permission?(:manage_messages) == true ||
event.user.defined_permission?(:administrator) == true ||
event.user.permission?(:manage_messages, event.channel) == true
event.defer
event.channel.prune(amount)
event.send_message(content: "`#{@user}` deleted #{amount} messages from channel")
else
event.respond(content: "#{@user} does not have permissions for this command")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_bogo_ops(string)\n string[/stress-ng: info: \\[\\d*\\] cpu\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)/, 5]\n end",
"def getHighestAbilityLetterFrom pattern\n remainWords = []\n @currentBucket.each {|bucketWord|\n remainWords += [bucketWord] if ... | [
"0.5139791",
"0.5050754",
"0.5040567",
"0.5025249",
"0.5007969",
"0.5000608",
"0.49780884",
"0.49296898",
"0.4912021",
"0.49031806",
"0.49031258",
"0.48843452",
"0.48091206",
"0.47855097",
"0.4780434",
"0.47623017",
"0.4758936",
"0.4755145",
"0.47475204",
"0.47462827",
"0.474... | 0.0 | -1 |
this is now deprecated with slash commands | def handle_prefix(event)
return false if event.channel.pm?
@prefix_setcmd = event.content.strip.to_s
@server = event.server.id
check_user_or_nick(event)
if @prefix_setcmd =~ /^(!dm prefix check)\s*$/i
@prefix_check = $db.execute "select prefix from prefixes where server = #{@server}"
if @prefix_check.empty?
event.respond(content: 'This servers prefix is set to: !roll')
return true
else
event.respond(content: "This servers prefix is set to: #{@prefix_check[0].join(', ')}")
return true
end
end
if @prefix_setcmd =~ /^(!dm prefix reset)\s*$/i
if event.user.defined_permission?(:manage_messages) == true ||
event.user.defined_permission?(:administrator) == true ||
event.user.permission?(:manage_messages, event.channel) == true
$db.execute "delete from prefixes where server = #{@server}"
event.respond(content: 'Prefix has been reset to !roll')
return true
else
event.respond(content: "#{@user} does not have permissions for this command")
return true
end
end
if @prefix_setcmd =~ /^(!dm prefix)/i
if event.user.defined_permission?(:manage_messages) == true ||
event.user.defined_permission?(:administrator) == true ||
event.user.permission?(:manage_messages, event.channel) == true
# remove command syntax and trailing which will be added later
@prefix_setcmd.slice!(/!dm prefix\s*/i)
if @prefix_setcmd.empty?
# do nothing if the set command is empty
return true
end
if @prefix_setcmd.size > 10
event.respond(content: 'Prefix too large. Keep it under 10 characters')
return true
end
@prefix_prune = @prefix_setcmd.delete(' ')
$db.execute "insert or replace into prefixes(server,prefix,timestamp) VALUES (#{@server},\"!#{@prefix_prune}\",CURRENT_TIMESTAMP)"
event.respond(content: "Prefix is now set to: !#{@prefix_prune}")
true
else
event.respond(content: "#{@user} does not have permissions for this command")
true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supercommand!() __supercommand__ end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def shell_api; end",
"def commands; end",
"def cmd; end",
"def shell_commands(cmd, *args); end",
"def shell_commands(cmd, args); ... | [
"0.6603829",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.64963824",
"0.6431876",
"0.64063287",
"0.6300021",
"0.62794733",
"0.6210728",
"0.61753446",
"0.6146379",
"0.60633326",
"0.60614026",
"0.60607177",
"0.605034",
"0.6042903",
"0.6... | 0.0 | -1 |
this is now deprecated with slash commands | def check_server_options(event)
if event.content =~ /(^!dm prefix)/i
if @launch_option == 'lite'
event.respond(content: 'This option is not supported with Dice Maiden Lite.')
return true
end
handle_prefix(event)
elsif event.content =~ /(^!dm request)/i
if @launch_option == 'lite'
event.respond(content: 'This option is not supported with Dice Maiden Lite.')
return true
end
set_show_request(event)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supercommand!() __supercommand__ end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def shell_api; end",
"def commands; end",
"def cmd; end",
"def shell_commands(cmd, *args); end",
"def shell_commands(cmd, args); ... | [
"0.6603829",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.65183556",
"0.64963824",
"0.6431876",
"0.64063287",
"0.6300021",
"0.62794733",
"0.6210728",
"0.61753446",
"0.6146379",
"0.60633326",
"0.60614026",
"0.60607177",
"0.605034",
"0.6042903",
"0.6... | 0.0 | -1 |
this is now deprecated with slash commands | def set_show_request(event)
return false if event.channel.pm?
request_setcmd = event.content.delete_prefix('!dm request').strip
server = event.server.id
check_user_or_nick(event)
if event.user.defined_permission?(:manage_messages) == true ||
event.user.defined_permission?(:administrator) == true ||
event.user.permission?(:manage_messages, event.channel) == true
if request_setcmd == 'show'
@request_option = true
$db.execute "insert or replace into server_options(server,show_requests,timestamp) VALUES (#{server},\"#{@request_option}\",CURRENT_TIMESTAMP)"
elsif request_setcmd == 'hide'
$db.execute "delete from server_options where server = #{server}"
else
event.respond(content: "'" + request_setcmd + "' is not a valid option. Please use 'show' or 'hide'.")
return true
end
event.respond(content: 'Requests will now be ' + (@request_option ? 'shown' : 'hidden') + ' in responses.')
true
else
event.respond(content: "#{@user} does not have permissions for this command")
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supercommand!() __supercommand__ end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def shell_api; end",
"def commands; end",
"def cmd; end",
"def shell_commands(cmd, *args); end",
"def shell_commands(cmd, args); ... | [
"0.66041696",
"0.6519286",
"0.6519286",
"0.6519286",
"0.6519286",
"0.6519286",
"0.6519286",
"0.64978373",
"0.64332736",
"0.6406627",
"0.630118",
"0.62806",
"0.62108153",
"0.6176256",
"0.6145445",
"0.6064148",
"0.60626096",
"0.60602117",
"0.6051212",
"0.60434514",
"0.6025319",... | 0.0 | -1 |
GET /todos GET /todos.json | def index
@todos = Todo.where(user_id: current_user.id). where(finish: false).offset(0).limit(PAGE_DISP_NUM).order("deadline DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @todos = Todo.all\n json_response(@todos)\n end",
"def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end",
"def index\n @todos = @list.todos\n render json: @todos\n end",
"def index\n @todos = Todo.all\n render json: @todos\n ... | [
"0.80015033",
"0.7946748",
"0.7915049",
"0.7910324",
"0.767061",
"0.75529414",
"0.7513659",
"0.74718785",
"0.74510056",
"0.7441282",
"0.74228525",
"0.7407939",
"0.7388406",
"0.72670317",
"0.7216767",
"0.7216767",
"0.71763384",
"0.71687216",
"0.7158836",
"0.71497715",
"0.71280... | 0.0 | -1 |
POST /todos POST /todos.json | def create
# バリデーション
if is_valid_todo(todo_params)
@todo = Todo.new(todo_params)
@todo.user_id = current_user.id
respond_to do |format|
if @todo.save
#format.html { redirect_to @todo, notice: 'Todo was successfully created.' }
#format.json { render :show, status: :created, location: @todo }
format.json { render json: @todo, status: :created}
else
#format.html { render :new }
format.json { render json: @todo.errors, status: :unprocessable_entity }
end
end
else
format.json {render json: "validation_error", status: :error}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end",
"def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
... | [
"0.77191365",
"0.7682156",
"0.7584383",
"0.7571844",
"0.7390803",
"0.7379874",
"0.73744744",
"0.7349123",
"0.7333154",
"0.73257005",
"0.7285942",
"0.7235614",
"0.722343",
"0.72165036",
"0.72165036",
"0.72165036",
"0.71789914",
"0.7135808",
"0.7118579",
"0.71103877",
"0.702635... | 0.68377125 | 29 |
PATCH/PUT /todos/1 PATCH/PUT /todos/1.json | def update
todo_params[:user_id] = current_user.id
todo_params[:updated_at] = Time.now
if is_valid_todo(todo_params)
respond_to do |format|
if @todo.update(todo_params)
#format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }
format.json { render json: @todo, status: :ok }
else
#format.html { render :edit }
format.json { render json: @todo.errors, status: :unprocessable_entity }
end
end
else
format.json {render json: "validation_error", status: :error}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json... | [
"0.73876435",
"0.73800725",
"0.72687894",
"0.7246782",
"0.70655125",
"0.70095533",
"0.695816",
"0.69538754",
"0.69361985",
"0.69361985",
"0.68700045",
"0.6847399",
"0.68226784",
"0.6788569",
"0.67627513",
"0.6751422",
"0.6751128",
"0.6751128",
"0.6726497",
"0.6714954",
"0.670... | 0.65661407 | 27 |
DELETE /todos/1 DELETE /todos/1.json | def destroy
@todo.destroy
respond_to do |format|
#format.html { redirect_to todos_url, notice: 'Todo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n ... | [
"0.7916336",
"0.78673315",
"0.7744077",
"0.7744077",
"0.7715195",
"0.7666539",
"0.7657615",
"0.7621787",
"0.7613744",
"0.76002884",
"0.7598053",
"0.7571139",
"0.7569953",
"0.7524624",
"0.75192124",
"0.7516524",
"0.7506767",
"0.74434906",
"0.7427797",
"0.7422746",
"0.73916245"... | 0.7296926 | 31 |
Use callbacks to share common setup or constraints between actions. | def set_todo
@todo = Todo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def todo_params
params.require(:todo).permit(:title, :todo, :deadline, :finish, :updated_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Get current line item for variant if exists Add variant qty to line_item | def add(variant, quantity, currency=nil, shipment=nil)
line_item = order.find_line_item_by_variant(variant)
add_to_line_item(line_item, variant, quantity, currency, shipment)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line_item_to_order( variant )\n duplicate_line_item = line_item_exists?( variant )\n duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item\n\n line_items.build :name => variant.good.name, \n :price => variant.price, \n ... | [
"0.8064057",
"0.7755228",
"0.74048954",
"0.724215",
"0.71905875",
"0.71327955",
"0.70411533",
"0.70286345",
"0.7001142",
"0.6993607",
"0.6870527",
"0.6864984",
"0.6861738",
"0.68241423",
"0.6776435",
"0.67309844",
"0.6688398",
"0.66866",
"0.66849166",
"0.6675545",
"0.6641142"... | 0.66466355 | 20 |
Get current line item for variant Remove variant qty from line_item | def remove(variant, quantity, shipment=nil)
line_item = order.find_line_item_by_variant(variant)
unless line_item
raise ActiveRecord::RecordNotFound, "Line item not found for variant #{variant.sku}"
end
remove_from_line_item(line_item, variant, quantity, shipment)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def remove(variant, quantity = 1, shipment = nil)\n line_item = orde... | [
"0.7368515",
"0.7139236",
"0.69500667",
"0.6828652",
"0.68204445",
"0.6719294",
"0.6652688",
"0.66402674",
"0.6624982",
"0.65296185",
"0.629788",
"0.628605",
"0.6254959",
"0.61943734",
"0.61935043",
"0.616874",
"0.6166004",
"0.61657834",
"0.6160096",
"0.61192286",
"0.609327",... | 0.7189742 | 1 |
params: access_token, name auth user's right | def create
name = params[:name]
@group = Group.new(name: name)
@group.creator_id = @current_user.id
if @group.save
@current_user.creator_join!(@group)
respond_with(@group, only: [:id, :name, :creator_id, :admin_id])
else
render_error(404, request.path, 20101, @group.errors.as_json)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_token\n end",
"def find_oauth_access_token\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def restrict_access\n user = User.find_by_authentication_token(params[:access_token])\n head :unauthorized unless user\n end",
"def authenti... | [
"0.6840983",
"0.66833955",
"0.6674698",
"0.6633889",
"0.6377201",
"0.6346206",
"0.6334128",
"0.63094854",
"0.6225599",
"0.6202588",
"0.62009734",
"0.6194478",
"0.6180327",
"0.6175354",
"0.6166969",
"0.61594015",
"0.61582386",
"0.6126202",
"0.6126202",
"0.6126202",
"0.6102777"... | 0.0 | -1 |
params: access_token, group_id member's right | def show
respond_with(@group, only: [:id, :name, :admin_id, :creator_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"auth\", @user, @group)\n end",
"def atest_ID_25873_access_granted_as_follower_of_a_private_group()\n login_as_user1\n read_all_updates\n groupName = create_any_new_grou... | [
"0.6494549",
"0.6379158",
"0.63727546",
"0.620584",
"0.61124986",
"0.60171694",
"0.6004824",
"0.6004409",
"0.598219",
"0.5950695",
"0.59488374",
"0.593673",
"0.59211487",
"0.59189284",
"0.58942175",
"0.58853483",
"0.5882451",
"0.58343893",
"0.5827207",
"0.5801884",
"0.5795609... | 0.0 | -1 |
params: access_token, group_id, group[variable] admin's right | def update
if @group.update_attributes(params[:group])
respond_with(@group, only: [:id, :name, :creator_id, :admin_id])
else
render_error(404, request.path, 20103, "Failed to update group info")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def authorize_group_access\n group_id = group_params[:id]\n\n return if group_id.blank?\n group = Group.find(group_id)\n... | [
"0.69551826",
"0.67079365",
"0.654343",
"0.64383984",
"0.6383407",
"0.63450813",
"0.6333881",
"0.63212365",
"0.6315154",
"0.6273549",
"0.62636423",
"0.6235166",
"0.6233018",
"0.62291163",
"0.61958206",
"0.6192573",
"0.61823225",
"0.6181392",
"0.6170887",
"0.6126428",
"0.61262... | 0.0 | -1 |
params: access_token, group_id admin's right | def destroy
if @group.destroy
render json: {result: 1}
else
render json: {result: 0}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def authorize_group_access\n group_id = group_params[:id]\n\n return if group_id.blank?\n group = Group.find(group_id)\n... | [
"0.67444026",
"0.66033125",
"0.6359763",
"0.6310548",
"0.6258549",
"0.6227555",
"0.61632097",
"0.6042519",
"0.60395366",
"0.60339767",
"0.6029276",
"0.60102075",
"0.6004544",
"0.59985596",
"0.5982154",
"0.5971557",
"0.59671026",
"0.59511214",
"0.591891",
"0.5911339",
"0.58932... | 0.0 | -1 |
params: access_token, group_id, user_id auth user's right | def is_admin
@user = User.find(params[:user_id])
@group = Group.find(params[:group_id])
if @user.is_admin?(@group)
render json: {result: 1}
else
render json: {result: 0}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"auth\", @user, @group)\n end",
"def user_params\n params.require(:user).permit(:current_user, :group_ids => [])\n end",
"def authorize\n \n token = decode_token(@... | [
"0.63575006",
"0.6049184",
"0.604473",
"0.59778386",
"0.5960033",
"0.5956082",
"0.5898231",
"0.58575445",
"0.5775208",
"0.5761696",
"0.5751896",
"0.57372",
"0.57253647",
"0.5716244",
"0.57036287",
"0.570008",
"0.5693296",
"0.5681172",
"0.56763816",
"0.5674352",
"0.5659018",
... | 0.54285604 | 68 |
params: access_token, group_id, user_id auth user's right | def is_creator
@user = User.find(params[:user_id])
@group = Group.find(params[:group_id])
if @user.is_creator?(@group)
render json: {result: 1}
else
render json: {result: 0}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"auth\", @user, @group)\n end",
"def user_params\n params.require(:user).permit(:current_user, :group_ids => [])\n end",
"def authorize\n \n token = decode_token(@... | [
"0.63575006",
"0.6049184",
"0.604473",
"0.59778386",
"0.5960033",
"0.5956082",
"0.5898231",
"0.58575445",
"0.5775208",
"0.5761696",
"0.5751896",
"0.57372",
"0.57253647",
"0.5716244",
"0.57036287",
"0.570008",
"0.5693296",
"0.5681172",
"0.56763816",
"0.5674352",
"0.5659018",
... | 0.54440606 | 62 |
params: access_token, group_id, user_id auth user's right | def is_member
@user = User.find(params[:user_id])
@group = Group.find(params[:group_id])
if @user.is_member?(@group)
render json: {result: 1}
else
render json: {result: 0}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"auth\", @user, @group)\n end",
"def user_params\n params.require(:user).permit(:current_user, :group_ids => [])\n end",
"def authorize\n \n token = decode_token(@... | [
"0.63575006",
"0.6049184",
"0.604473",
"0.59778386",
"0.5960033",
"0.5956082",
"0.5898231",
"0.58575445",
"0.5775208",
"0.5761696",
"0.5751896",
"0.57372",
"0.57253647",
"0.5716244",
"0.57036287",
"0.570008",
"0.5693296",
"0.5681172",
"0.56763816",
"0.5674352",
"0.5659018",
... | 0.53499067 | 91 |
params: access_token, group_id auth user's right | def count
@group = Group.find(params[:group_id])
render json: {group_id: @group.id,
user_count: @group.users.count}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"auth\", @user, @group)\n end",
"def authorize_group_access\n group_id = group_params[:id]\n\n return if group_id.blank?\n group = Group.find(group_id)\n validate_max... | [
"0.6468812",
"0.6372567",
"0.6303857",
"0.61229575",
"0.6084216",
"0.60224223",
"0.5995105",
"0.59465396",
"0.5930729",
"0.5912493",
"0.59118164",
"0.5902506",
"0.58922577",
"0.584131",
"0.5817653",
"0.5808346",
"0.5796773",
"0.5779347",
"0.57419986",
"0.57265806",
"0.5723576... | 0.0 | -1 |
params: access_token, group_id, user_id admin's right | def transfer_admin
if current_user?(@referred_user)
render_error(404, request.path, 20111, "Cannot transfer admin to yourself.")
else
change_admin(@current_user, @referred_user, @group)
respond_with(@group, only: [:id, :name, :admin_id, :creator_id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def authorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_mem... | [
"0.6607673",
"0.62952274",
"0.62482536",
"0.621722",
"0.6177386",
"0.61736095",
"0.6147965",
"0.6136622",
"0.60611504",
"0.5976173",
"0.5948618",
"0.5939546",
"0.59322554",
"0.5928344",
"0.5921388",
"0.59211123",
"0.5912541",
"0.59036434",
"0.5895558",
"0.5873199",
"0.5865671... | 0.0 | -1 |
calculates and saves the current portfolio | def update_portfolio
buys = self.buyer_transactions.where("transaction_type_id = 0").select("stock_id, sum(amount) as total").group("stock_id")
sells = self.seller_transactions.where("transaction_type_id = 0").select("stock_id, sum(amount) as total").group("stock_id")
self.cash_in = self.seller_transactions.where("transaction_type_id = 1").sum('amount * price')
self.investment = 0
self.profit = 0
self.balance = self.calculate_balance
p = {}
p[:stocks] = {}
# go through transactions to get current portfolio
buys.each do |buy|
stock = Stock.find(buy.stock_id)
# add stocks to portfolio according to buys
p[:stocks][buy.stock_id] = {:amount => buy.total, :stock => stock}
sells.each do |sell|
if buy.stock_id == sell.stock_id
# subtract stocks from portfolio according to sells
p[:stocks][buy.stock_id][:amount] = buy.total - sell.total
end
end
end
p[:stocks].each do |stock_id, data|
# save portfolio in ownerships
ownership = Ownership.where(:user_id => self.id, :stock_id => stock_id).first_or_create
ownership.amount = data[:amount]
# investment: how much did the user pay for the stocks he bought last?
buys = self.buyer_transactions.where(:stock_id => stock_id).order('created_at DESC')
counter = data[:amount]
investment = 0
buys.each do |buy|
if counter - buy.amount > 0
investment += buy.price * buy.amount
else
investment += buy.price * counter
break
end
counter -= buy.amount
end
ownership.investment = investment
self.investment += investment
# avg_price: how much did the user pay for the stocks he bought last on avg
ownership.avg_price = (ownership.investment / ownership.amount).round(2)
# profit: how much money did the user make trading this stock
gains = self.seller_transactions.where(:stock_id => stock_id).sum('amount * price')
losses = self.buyer_transactions.where(:stock_id => stock_id).sum('amount * price')
ownership.profit = gains - losses
self.profit += ownership.profit
ownership.save
end
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portfolio\n \n p = {}\n \n p[:cash_in] = self.cash_in\n p[:total_investment] = self.investment\n p[:total_profit] = self.profit\n p[:balance] = self.balance\n p[:total_stocks] = 0\n\n # copy cached ownership info into portfolio data structure\n p[:stocks] = {} \n Ownership.w... | [
"0.73802567",
"0.72309715",
"0.7147288",
"0.67670226",
"0.65593815",
"0.65475404",
"0.6492274",
"0.64522165",
"0.63220936",
"0.6260455",
"0.6249478",
"0.6197417",
"0.6195603",
"0.6195603",
"0.6195603",
"0.6195603",
"0.6195603",
"0.61716515",
"0.6161525",
"0.60817486",
"0.6050... | 0.7358699 | 1 |
retrieves the cached portfolio from db, calculates current values and formats output | def portfolio
p = {}
p[:cash_in] = self.cash_in
p[:total_investment] = self.investment
p[:total_profit] = self.profit
p[:balance] = self.balance
p[:total_stocks] = 0
# copy cached ownership info into portfolio data structure
p[:stocks] = {}
Ownership.where(:user_id => self.id).each do |o|
if o.amount.nil?
o.amount = 0
o.save
end
p[:stocks][o.stock_id] = {:amount => o.amount, :stock => o.stock, :investment => o.investment, :avg_price => o.avg_price, :profit => o.profit}
p[:total_stocks] += o.amount
end
p[:total_value] = 0
# calculate current value
p[:stocks].each do |stock_id, data|
# value: how much is the stock currently worth on the market
data[:value] = data[:amount] * data[:stock].price
p[:total_value] += data[:value]
end
# do some additional calculations
p[:total_investment_rel] = ((self.investment / self.cash_in) * 100).round(2)
p[:total_profit_rel] = StocksHelper.rel_percent p[:cash_in], p[:balance]
p[:total_value_rel] = StocksHelper.rel_percent p[:total_investment], p[:total_value]
return p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n @portfolios = Portfolio.where(user_id: session[:user_id]).decorate\n Portfolio.transaction do\n Portfolio.refresh_costs(@portfolios, current_user)\n @portfolios.map(&:reload)\n end\n @portfolios.sort!{ |a,b| b.difference.to_i.abs <=> a.difference.to_i.abs }\n end",
"def calcul... | [
"0.6931591",
"0.6853272",
"0.68249077",
"0.64563465",
"0.6410445",
"0.6373871",
"0.6264558",
"0.6109764",
"0.60947347",
"0.6090966",
"0.6085267",
"0.6055245",
"0.60304475",
"0.5999199",
"0.5997542",
"0.5997542",
"0.59785163",
"0.59528863",
"0.5938047",
"0.59323186",
"0.592952... | 0.74004644 | 0 |
extract ranks for single user | def ranks
r = {}
data_hash = User.all_ranks
return data_hash[self.id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_rank!\n r = 1\n users.order('rating DESC').each do |u|\n user_universities.find_by_user_id(u.id).update_attribute(:rank, r)\n r += 1\n end\n end",
"def users_ranking\n User.find_by_sql(\"SELECT U.id, U.name, COUNT(R.id) ediciones\n FROM users U, reviews R, species S, groups ... | [
"0.6843636",
"0.6611518",
"0.6521465",
"0.6447582",
"0.6429373",
"0.6418296",
"0.6360341",
"0.63346153",
"0.6332309",
"0.6201148",
"0.61882585",
"0.61407214",
"0.6000644",
"0.59706384",
"0.59671324",
"0.59671324",
"0.59512514",
"0.5933594",
"0.5922736",
"0.59056056",
"0.58649... | 0.7611172 | 0 |
add amount euros to users balance | def add_cash(amount)
transaction = Transaction.new
transaction.transaction_type_id = 1
transaction.seller_id = self.id
transaction.price = Setting.first.exchange_rate
transaction.amount = amount
transaction.save
self.update_portfolio
return transaction
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_balance\n self.user.balance += self.price\n self.user.save\n end",
"def add_amount(amount)\n @balance += amount\n end",
"def add_amount_to(transactions, value) \n transactions.each do |transaction|\n new_balance = transaction.account_balance + value\n transa... | [
"0.780064",
"0.75906014",
"0.7387476",
"0.72898453",
"0.7242946",
"0.7242946",
"0.72421014",
"0.72095853",
"0.71704364",
"0.7146653",
"0.71444446",
"0.71444446",
"0.71444446",
"0.7140288",
"0.70852154",
"0.70716155",
"0.7060013",
"0.7027341",
"0.7006205",
"0.69975305",
"0.698... | 0.0 | -1 |
get '/mountains' do "Hello World" end | def db_query(sql)
db = SQLite3::Database.new("database.db") #connect to database
db.results_as_hash = true
puts "="*100
p sql
# puts sql.red
puts "="*100
result = db.execute( sql )
db.close #close the connection
result #this is what this method returns
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test\")\n end",
"def get(path, &block)\n route 'GET', path, &block\n end",
"def routes\n request :get, '/routes'\n end",
"def root\n get '/'\n end",
"def get(path, &handler)\n route(\"GET\", path, &handler)\n end",
"def root\n get \"... | [
"0.6722108",
"0.66266125",
"0.65225244",
"0.6482597",
"0.6461426",
"0.6450689",
"0.6450689",
"0.6450537",
"0.6324784",
"0.6235395",
"0.6235395",
"0.62153983",
"0.6198747",
"0.6183389",
"0.61675143",
"0.6165686",
"0.6136457",
"0.6136457",
"0.61046755",
"0.6087242",
"0.6059779"... | 0.0 | -1 |
GET /account/job_applications GET /account/job_applications.json | def index
@job_applications = @job_applications_active
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).pe... | [
"0.7510918",
"0.7492585",
"0.7164594",
"0.71217585",
"0.7111424",
"0.7080946",
"0.7066626",
"0.70239973",
"0.6958211",
"0.68008006",
"0.67743784",
"0.6687146",
"0.66050124",
"0.65842485",
"0.65577096",
"0.6515239",
"0.6508788",
"0.6481662",
"0.6473773",
"0.6473773",
"0.646866... | 0.7212989 | 2 |
GET /account/job_applications/finished GET /account/job_applications/finished.json | def finished
@job_applications = @job_applications_finished
render action: :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.done(params[:success] || params[:success] == 'true')\n flash[:notice] = @job.successful ? 'Job was successfully finished.' : 'Job was finished with errors.'\n Notifier.deliver_notify_user_of_job_completion(@job) i... | [
"0.65828496",
"0.62854946",
"0.61899877",
"0.6179979",
"0.6116521",
"0.60426384",
"0.6017907",
"0.6008345",
"0.59705746",
"0.5970438",
"0.5968134",
"0.5959194",
"0.5938749",
"0.59231687",
"0.5883736",
"0.5883736",
"0.5882715",
"0.58731884",
"0.5872551",
"0.5847961",
"0.584785... | 0.8169349 | 0 |
GET /account/job_applications/1 GET /account/job_applications/1.json | def show
@emails = @job_application.emails.order(created_at: :desc)
@email = @job_application.emails.new
render layout: request.xhr? ? false : true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).pe... | [
"0.7362795",
"0.7349275",
"0.72335106",
"0.7105198",
"0.69650465",
"0.6925819",
"0.6920149",
"0.690324",
"0.69021463",
"0.6707724",
"0.6699148",
"0.6692048",
"0.66343975",
"0.66318995",
"0.66227794",
"0.66227794",
"0.66205984",
"0.6611117",
"0.66103584",
"0.66103584",
"0.6610... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_job_application
@job_application = current_user.job_applications.find(params[:job_application_id] || params[:id])
@job_offer = @job_application.job_offer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
this shows the user's own posts, as user_posts(user) | def index
@user_posts = Post.where(user_id: current_user.id).where(active: true).order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @posts = Post.user_posts current_user\n end",
"def show\n @posts = @user.posts\n end",
"def show\n\n @posts = @user.posts #11/19 Mypostsを表示\n end",
"def index\n @posts = @current_user.posts\n end",
"def show\n \tif(logged_in)\n \t\t@posts = User.find(@user.id).posts\n \tels... | [
"0.7414282",
"0.7255786",
"0.7152099",
"0.71372736",
"0.7128897",
"0.7039018",
"0.7018779",
"0.7005493",
"0.6994838",
"0.69933796",
"0.6965921",
"0.69111955",
"0.6909592",
"0.6772232",
"0.6683668",
"0.66655874",
"0.6661107",
"0.6657836",
"0.66571105",
"0.6656415",
"0.66316944... | 0.6481328 | 35 |
call this to render template source use this method in layouts to insert a layout's content source | def __yield
return if @_undies_source_stack.nil? || (source = @_undies_source_stack.pop).nil?
if source.file?
instance_eval(source.data, source.source, 1)
else
instance_eval(&source.data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_content\n do_include(@template)\n end",
"def render_template(view, template, layout_name, locals); end",
"def render\n layout = File.read \"#{site.root}/_layouts/#{@layout}.html\"\n @output = Liquid::Template.parse(layout).render('post'=>self) \n end",
"def place_in_layouts(content... | [
"0.69303334",
"0.68984437",
"0.6813255",
"0.6745191",
"0.67269385",
"0.6575535",
"0.6554137",
"0.6541704",
"0.6529032",
"0.6480395",
"0.64775115",
"0.64244616",
"0.640286",
"0.6388529",
"0.6358667",
"0.63171667",
"0.62834406",
"0.62825215",
"0.62749356",
"0.6265714",
"0.62486... | 0.0 | -1 |
call this to render partial source embedded in a template partial source is rendered with its own scope/data but shares its parent template's output object | def __partial(source, data)
Undies::Template.new(source, data, @_undies_output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def render_partial(context, options, &block); end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer... | [
"0.74765587",
"0.7341391",
"0.7085893",
"0.6889318",
"0.6872837",
"0.6764386",
"0.6754263",
"0.672056",
"0.66915524",
"0.66915524",
"0.66189086",
"0.6611903",
"0.65935105",
"0.6503986",
"0.64484257",
"0.64460516",
"0.6431554",
"0.6419661",
"0.6419661",
"0.64072585",
"0.637755... | 0.69250906 | 3 |
Add a text node (data escaped) to the nodes of the current node | def _(data=""); self.__ self.escape_html(data.to_s); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_text_child(text)\n text_tag = Tag.new(\"text\", text)\n @current_node.children.push text_tag\n text_tag.parent = @current_node\n # text_tag.depth = @current_node.depth\n end",
"def text(content)\n @nodes << TextNode.new(content)\n self\n end",
"def createTextNode(d... | [
"0.7402319",
"0.7265906",
"0.711626",
"0.70216936",
"0.6807365",
"0.6804287",
"0.67626226",
"0.67546237",
"0.66503924",
"0.6615331",
"0.65577555",
"0.65520936",
"0.65520936",
"0.6546895",
"0.6539841",
"0.6532641",
"0.64562786",
"0.64537907",
"0.64537907",
"0.6440339",
"0.6438... | 0.0 | -1 |
Add a text node with the data unescaped | def __(data=""); @_undies_output.node(data.to_s); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createTextNode(data)\n ret = Text.new(data)\n ret.ownerDocument = self\n ret\n end",
"def add_text(text)\n return if text.empty?\n\n if text.frozen?\n text = text.gsub(/['\\\\]/, '\\\\\\\\\\&')\n else\n text.gsub!(/['\\\\]/, '\\\\\\\\\\&')\n end\n\n... | [
"0.72847164",
"0.6998229",
"0.68660665",
"0.67594755",
"0.67581785",
"0.6634751",
"0.6634751",
"0.66224295",
"0.6566012",
"0.6562021",
"0.6519297",
"0.6453878",
"0.6424259",
"0.6424259",
"0.63610065",
"0.6348418",
"0.6334102",
"0.63165045",
"0.62885237",
"0.6268493",
"0.62384... | 0.0 | -1 |
Add an element to the nodes of the current node | def element(*args, &block); @_undies_output.element(*args, &block); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_node(node); end",
"def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n ... | [
"0.7792907",
"0.7309038",
"0.72892666",
"0.72438204",
"0.72317994",
"0.7053422",
"0.6938803",
"0.69094694",
"0.68654126",
"0.6860075",
"0.6860075",
"0.6816193",
"0.6815823",
"0.67890227",
"0.670476",
"0.66845226",
"0.66823405",
"0.6678077",
"0.666225",
"0.6650319",
"0.6650319... | 0.0 | -1 |
Escape ampersands, brackets and quotes to their HTML/XML entities. | def escape_html(string)
string.to_s.gsub(ESCAPE_HTML_PATTERN){|c| ESCAPE_HTML[c] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_escape(s)\n s.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\")\n end",
"def escape_html(html)\n html.to_s.gsub(/&/n, '&').gsub(/\\\"/n, '"').gsub(/>/n, '>').gsub(/</n, '<').gsub(/\\//, '/')\n end",
"def html_escape(text)\n ... | [
"0.7829668",
"0.779935",
"0.7631167",
"0.7606816",
"0.7508268",
"0.74773234",
"0.7474295",
"0.73971254",
"0.73826885",
"0.73787886",
"0.73419696",
"0.7339938",
"0.73058534",
"0.7269033",
"0.72525674",
"0.7235924",
"0.7227527",
"0.7216798",
"0.7216798",
"0.72091794",
"0.719813... | 0.6232494 | 74 |
Whether or not to include in item list item : item | def include?(item)
return item != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(item)\n return true\n end",
"def extra_item?\n false\n end",
"def include?(item)\n end",
"def include?(item)\n ! get(item).nil?\n end",
"def include?(item)\n return false if item.nil?\n return true\n end",
"def includes item\n msg = \"#{self} did not include #{item... | [
"0.7721838",
"0.76347744",
"0.7532898",
"0.7394234",
"0.7251723",
"0.7233726",
"0.7154766",
"0.7093502",
"0.7055652",
"0.70295596",
"0.69157076",
"0.6900268",
"0.6799219",
"0.67787296",
"0.67312205",
"0.67238545",
"0.67238545",
"0.6717945",
"0.6715319",
"0.67140734",
"0.67054... | 0.7150044 | 7 |
Whether or not to display in enabled state item : item | def enable?(item)
return (item.price > 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_item_enabled?\n true\n end",
"def current_item_enabled?\n return true\n end",
"def enable?(item)\n item.enabled?\n end",
"def enable?(item)\n item.enabled?\n end",
"def current_item_enabled?\r\n current_data ? current_data[:enabled] : false\r\n end",
"def current_item_enab... | [
"0.8095887",
"0.8017462",
"0.79665726",
"0.79665726",
"0.7796157",
"0.77506685",
"0.7695043",
"0.7616796",
"0.7616796",
"0.76061475",
"0.7601957",
"0.74774003",
"0.7459621",
"0.7459621",
"0.74483293",
"0.74419934",
"0.743488",
"0.7415688",
"0.7415688",
"0.7415688",
"0.7415688... | 0.6872423 | 33 |
don't have to pass master_pics everytime because results get cached anyway. | def correct(master_pics = nil)
@correct_pics ||= self.select do |pic|
pic.bid_id && master_pics.detect { |p| pic.game_id == p.game_id }.bid_id == pic.bid_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_album_photos\n # @pictures = Picture.paginate(:page => params[:page], :per_page => 5)\n @curr_album = Album.find(params[:id])\n @pictures = @curr_album.shared_pictures(@login_user.id,params[:page].to_i)\n end",
"def person_photos\n Gallerist::PersonPhoto.where master_uuid: master.uuid\n en... | [
"0.64380205",
"0.6273853",
"0.62156385",
"0.61517",
"0.60718495",
"0.5930902",
"0.59281296",
"0.5866265",
"0.58563393",
"0.58509684",
"0.58436847",
"0.58327156",
"0.5784903",
"0.5781588",
"0.57815456",
"0.57768923",
"0.5705503",
"0.5699545",
"0.5675552",
"0.567388",
"0.566678... | 0.6390813 | 1 |
calculate total points earned by this PoolUser. | def calculate_points(master_pics, scoring_system = ScoringSystems.default)
@points = 0
pics.correct(master_pics).each do |pic|
@points += pic.point_worth(scoring_system)
end
@points
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_points\n self.user_points.reduce(0) { |sum, points| sum + points.point_category.number_of_points}\n end",
"def total_points\n if self.has_paid?\n sum = 0\n self.bets.each { |b| sum+=b.points }\n self.answers.each { |a| sum+=a.points }\n sum\n else\n -1\n end\n end... | [
"0.77317023",
"0.70932996",
"0.706385",
"0.6909247",
"0.6790843",
"0.67686915",
"0.67536867",
"0.67048717",
"0.6671766",
"0.6650956",
"0.66420424",
"0.66420424",
"0.6628927",
"0.657589",
"0.657589",
"0.6517112",
"0.6511768",
"0.64529413",
"0.64529413",
"0.63079053",
"0.630036... | 0.57477546 | 71 |
Free Splash Image from Memory | def dispose_splashscreen
@sprite.bitmap.dispose
@sprite.dispose
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n self.image = nil\n GC.start\n end",
"def cleanup\n self.image = nil\n GC.start\n end",
"def unload_image(image_handle)\n end",
"def dispose_maqj_picture\n @maqj_picture_sprite.dispose if @maqj_picture_sprite\n end",
"def dispose_battleback_bitmap\n @battlebac... | [
"0.70700425",
"0.70700425",
"0.67199796",
"0.6339967",
"0.631034",
"0.6147555",
"0.6130839",
"0.6105169",
"0.60769624",
"0.6007657",
"0.60008454",
"0.60006785",
"0.5996949",
"0.59496343",
"0.59419507",
"0.5923604",
"0.59014904",
"0.5866837",
"0.5822605",
"0.57995874",
"0.5770... | 0.72942966 | 0 |
Move Splash Image to Center | def center_splashscreen(sprite)
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_im(sprite)\n sprite.ox = sprite.width / 2\n sprite.oy = sprite.height / 2\n end",
"def center\n move(90)\n end",
"def center_sprite(sprite)\n sprite.ox = sprite.bitmap.width / 2\n sprite.oy = sprite.bitmap.height / 2\n sprite.x = Graphics.width / 2\n sprite.y = Graphic... | [
"0.66069525",
"0.64006484",
"0.62384856",
"0.62384856",
"0.61774963",
"0.610229",
"0.5999198",
"0.5997933",
"0.59430677",
"0.5846634",
"0.5821888",
"0.5776053",
"0.5776053",
"0.57433563",
"0.570513",
"0.56711274",
"0.5562244",
"0.5543555",
"0.55433184",
"0.5536344",
"0.553358... | 0.7895829 | 0 |
Transition To Title Screen delay: Delay time in between scene transitions | def goto_title(delay = 30)
fadeout_all
Graphics.wait(delay)
SceneManager.goto(Scene_Title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_to_title\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Fade out BGM, BGS, and ME\r\n Audio.bgm_fade(800)\r\n Audio.bgs_fade(800)\r\n Audio.me_fade(800)\r\n # Switch to title screen\r\n $scene = Scene_Title.new\r\n end",
"def main_end\r\n s... | [
"0.68818",
"0.6810122",
"0.66802955",
"0.6589058",
"0.6448279",
"0.643332",
"0.64168847",
"0.60103136",
"0.59342736",
"0.58851063",
"0.58148825",
"0.58069956",
"0.5803457",
"0.5787647",
"0.57708436",
"0.57388866",
"0.57083195",
"0.5704708",
"0.566102",
"0.5647868",
"0.5640495... | 0.8210427 | 0 |
new method: Transition to Splash Screen | def goto_splash
fadeout_all
SceneManager.goto(Scene_Splash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splash_page\n end",
"def main_menu_runner\n\n splash\n\n login_menu_display\n\n end",
"def makeSplash\n clearScreen\n splash = ConsoleSplash.new(15,70)\n splash.write_header(\"Welcome to Sokoban\",\"Ben Cornforth\",\"Alpha Build, November 2015\",{:nameFg=>:green,:authorFg=>:green, :versionFg=>:g... | [
"0.7675753",
"0.6858375",
"0.6599237",
"0.64309514",
"0.6415116",
"0.6329779",
"0.6251206",
"0.6193508",
"0.6186813",
"0.6167906",
"0.61110425",
"0.60851675",
"0.6083918",
"0.60745895",
"0.5965515",
"0.5965515",
"0.5952367",
"0.5934509",
"0.5804622",
"0.57274485",
"0.5720805"... | 0.7737489 | 0 |
A default msg method in case the termansicolor gem isn't installed... | def msg(m, fg = nil, bg = nil)
m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message( msg, details='' )\n\t\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + details\n\t\tend",
"def error(msg)\n puts \"\\e[0;31m#{ msg }\\e[0m\"\n end",
"def error_message( msg, details='' )\n\t\t$stderr.puts colorize( 'bold', 'white', 'on_red' ) { msg } + ' ' + details\n\... | [
"0.6698881",
"0.66881526",
"0.6680915",
"0.6563973",
"0.65303457",
"0.64081424",
"0.63884807",
"0.63884807",
"0.63070095",
"0.62809426",
"0.61979705",
"0.6187444",
"0.61864877",
"0.61864877",
"0.6171623",
"0.6147538",
"0.614518",
"0.61443585",
"0.61362326",
"0.60699767",
"0.6... | 0.62837005 | 10 |
GET /weblings/1 GET /weblings/1.json | def show
@webling = Webling.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @webling }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @web = Web.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web }\n end\n end",
"def new\n @webling = Webling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @webling }\... | [
"0.69977915",
"0.64244807",
"0.640219",
"0.6338537",
"0.63348544",
"0.63128954",
"0.6306903",
"0.62396985",
"0.6236385",
"0.6214677",
"0.6207342",
"0.6185464",
"0.61845106",
"0.61829215",
"0.6147064",
"0.6146732",
"0.6143537",
"0.6087364",
"0.60851365",
"0.60816455",
"0.60808... | 0.7496547 | 0 |
GET /weblings/new GET /weblings/new.json | def new
@webling = Webling.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @webling }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @press }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
... | [
"0.7177168",
"0.7159563",
"0.7144465",
"0.7099905",
"0.7088885",
"0.7083978",
"0.70603526",
"0.70597327",
"0.70596766",
"0.7059015",
"0.7058136",
"0.70379454",
"0.7010438",
"0.70038015",
"0.69961244",
"0.6989279",
"0.6989279",
"0.6986415",
"0.69684625",
"0.69622254",
"0.69610... | 0.78873295 | 0 |
POST /weblings POST /weblings.json | def create
@webling = Webling.new(params[:webling])
respond_to do |format|
if @webling.save
format.html { redirect_to @webling, notice: 'Webling was successfully created.' }
format.json { render json: @webling, status: :created, location: @webling }
else
format.html { render action: "new" }
format.json { render json: @webling.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @webling = Webling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @webling }\n end\n end",
"def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n ... | [
"0.6274967",
"0.60961795",
"0.6055117",
"0.6047243",
"0.6025532",
"0.60034996",
"0.6001525",
"0.5924261",
"0.5866066",
"0.5732944",
"0.5710705",
"0.57079506",
"0.5701069",
"0.56912",
"0.5686813",
"0.5679642",
"0.56581944",
"0.56307685",
"0.5613885",
"0.5591287",
"0.55865145",... | 0.6990544 | 0 |
PUT /weblings/1 PUT /weblings/1.json | def update
@webling = Webling.find(params[:id])
respond_to do |format|
if @webling.update_attributes(params[:webling])
format.html { redirect_to @webling, notice: 'Webling was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @webling.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @web = Web.find(params[:id])\n\n respond_to do |format|\n if @web.update_attributes(params[:web])\n format.html { redirect_to @web, notice: 'Web was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.63966846",
"0.61629975",
"0.6072793",
"0.60303116",
"0.602698",
"0.60156965",
"0.59779996",
"0.59596354",
"0.59446645",
"0.5924456",
"0.58154935",
"0.580964",
"0.57754964",
"0.5761185",
"0.5759177",
"0.5757143",
"0.57536495",
"0.57495356",
"0.5747794",
"0.57444096",
"0.574... | 0.6799518 | 0 |
DELETE /weblings/1 DELETE /weblings/1.json | def destroy
@webling = Webling.find(params[:id])
@webling.destroy
respond_to do |format|
format.html { redirect_to weblings_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @web = Web.find(params[:id])\n @web.destroy\n\n respond_to do |format|\n format.html { redirect_to webs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\ne... | [
"0.7194807",
"0.69073594",
"0.69067866",
"0.68755376",
"0.6847305",
"0.6820079",
"0.68094635",
"0.6804198",
"0.68035394",
"0.68035394",
"0.68035394",
"0.68035394",
"0.6802242",
"0.6782258",
"0.6772575",
"0.6762357",
"0.67617625",
"0.6743862",
"0.6699854",
"0.66817075",
"0.667... | 0.718539 | 1 |
Create new LaEnv instance Expected +args+ keys :lastore path fro storage root :quiet enable or disable logging | def initialize(args={})
@quiet = args.delete(:quiet) || false
@lastore = File.expand_path(args.delete(:lastore)|| "~/.config/lapack")
@ladb = "db"
@lapkg = "pkg"
FileUtils.mkdir_p(dbs_store)
raise "Unknown args #{args.keys.join(', ')}" unless args.keys.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*args)\n @env = args.first\n end",
"def initialize(*args, &block)\n @id = self.class.get_id\n if args.first.is_a?(String)\n base_name = args.slice!(0)\n else\n base_name = \"e.#{@id}\"\n end\n variant_keys = (Rscons.application.active_variants... | [
"0.6409939",
"0.622499",
"0.5995096",
"0.59832555",
"0.59724903",
"0.5769216",
"0.5743712",
"0.56701106",
"0.56411546",
"0.5571677",
"0.5568075",
"0.5561752",
"0.5553671",
"0.5551235",
"0.5539004",
"0.55260766",
"0.5518663",
"0.5518663",
"0.5518663",
"0.5502914",
"0.5495512",... | 0.6656798 | 0 |
Check if loggin is turned on | def quiet?
@quiet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n\t\t!current_golfer.nil?\n\tend",
"def needs_login?() false end",
"def can_log_in?\n !disabled\n end",
"def logged_in?\n @logged_in == true\n end",
"def logged_in?\n @logged_in == true\n end",
"def check_if_login_required\n false\n end",
"def _is_logi... | [
"0.73755324",
"0.72191656",
"0.7211906",
"0.71920496",
"0.71920496",
"0.7148021",
"0.71307874",
"0.71083856",
"0.71083856",
"0.71083856",
"0.71083856",
"0.70895386",
"0.7044413",
"0.7030577",
"0.69805634",
"0.6959179",
"0.69563204",
"0.6940309",
"0.6932368",
"0.69301915",
"0.... | 0.0 | -1 |
Returns list of plugged dbs | def dbs
@dbs_hash.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dbs(db=nil)\n db &&= db.gsub(/[\\\\\\']/){\"\\\\#{$&}\"}\n query(db ? \"show databases like '#{db}'\" : \"show databases\").map(&:first)\n end",
"def databases\n get '_all_dbs'\n end",
"def printGetSupportedDBs()\n printDebugMessage('printGetSupportedDBs', 'Begin', 1)\n dbInfoList... | [
"0.7178185",
"0.71725",
"0.69809973",
"0.69576335",
"0.6937381",
"0.6937381",
"0.691242",
"0.67409647",
"0.66531634",
"0.6648643",
"0.66111183",
"0.660588",
"0.6599184",
"0.6520857",
"0.6503281",
"0.6490184",
"0.64290416",
"0.64260924",
"0.63850975",
"0.636189",
"0.6343547",
... | 0.7217299 | 0 |
Init db instance in local store | def add(db, params = {})
if(db.to_sym.eql?(:ctan))
File.open(File.join(dbs_store, "#{db}.db"), "w") {|f| f << {name: 'ctan', clazz: 'CtanProvider', params: {}}.to_json}
else
raise "Unsupported"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n #puts \"in initialize of class #{self.class.to_s}\"\n\n @store = get_store\n ActiveRecord::Base.connection = @store\n end",
"def initialize\n self.db = YAML::Store.new(DB_FILE)\n end",
"def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n... | [
"0.7329325",
"0.7113716",
"0.7069002",
"0.6977533",
"0.697443",
"0.6950054",
"0.68917745",
"0.68820333",
"0.6853088",
"0.68442684",
"0.68442684",
"0.678164",
"0.67755055",
"0.6761431",
"0.6759509",
"0.6753659",
"0.6744198",
"0.67287254",
"0.67105615",
"0.66989493",
"0.6698725... | 0.0 | -1 |
Check if we support +dbtype+ | def supports?(dbtype)
(:ctan.eql? dbtype.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_type\n @db_type || self.class.db_type\n end",
"def db_type\n @db_type || self.class.db_type\n end",
"def valid_type?(type)\n !native_database_types[type].nil?\n end",
"def type_supported?(type)\n Sequel.synchronize{return @supported_types[type] if @su... | [
"0.762143",
"0.762143",
"0.75524944",
"0.7345472",
"0.7277032",
"0.7133891",
"0.69370157",
"0.69317716",
"0.6855211",
"0.6825903",
"0.6813181",
"0.67729324",
"0.6751216",
"0.67452",
"0.6703103",
"0.6689174",
"0.66813815",
"0.66797185",
"0.66789645",
"0.66730696",
"0.6652497",... | 0.8588134 | 0 |
System medthod to init db structure | def dbs_init
@dbs_hash = Dir["#{dbs_store}/*.db"]
.map do |dbfile|
File.open(dbfile){|f| JSON.parse(f.read, symbolize_names: true)}
end
.inject({}) do |h, db|
h.update({
db[:name].to_sym => LaPack::const_get(db[:clazz]).new(self, db[:params])
})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_database\n Hanami::Model.load!\n end",
"def init_database\n\t\tif(!@DB.table_exists?(:events))\n\t\t\t@DB.create_table :events do\n\t\t\t\tprimary_key :id\n\t\t\t\tString :name\n\t\t\t\tString :description\n\t\t\t\tString :date\n\t\t\tend\n\t\tend\n\n\t\tif(!@DB.table_exists?(:timeslots))\n\t\t... | [
"0.73018223",
"0.71676093",
"0.6997678",
"0.6957833",
"0.6896116",
"0.68658155",
"0.6842013",
"0.6823203",
"0.6687336",
"0.6675075",
"0.666211",
"0.66535115",
"0.6651465",
"0.6636484",
"0.6634296",
"0.66304713",
"0.6613827",
"0.657624",
"0.6564347",
"0.6542489",
"0.65175545",... | 0.67692643 | 8 |
GET /jobs/1 GET /jobs/1.xml | def show
@job = Job.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def getJobApi (options)\n uri = options[:job] + \"?depth=\" + options[:depth].to_s\n job_uri = URI.parse(uri)\n http = Net::HTTP.new(job_uri.hos... | [
"0.7036172",
"0.7022433",
"0.69805336",
"0.6919156",
"0.6904993",
"0.6724512",
"0.67069477",
"0.6669827",
"0.6622953",
"0.6582649",
"0.65720886",
"0.6570132",
"0.6522732",
"0.6514824",
"0.64877105",
"0.6485272",
"0.64750725",
"0.6471768",
"0.6452575",
"0.64371556",
"0.6432450... | 0.67145115 | 10 |
GET /jobs/new GET /jobs/new.xml | def new
@job = Job.new
@job.job_id = params[:job_id]
@job.supplier_id = params[:supplier_id]
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.n... | [
"0.77082497",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.7629433",
"0.75773835",
"0.7474243",
"0.7435303",
"0.7314147",
"0.7284292",
"0.712693",
"0.7091252",
"0.7091252",
"0.7058218",
"0.7058218",
"0.7058218",
... | 0.6432218 | 52 |
POST /jobs POST /jobs.xml | def create
@job = Job.new(params[:job])
#@job.supplier_id = params[:supplier_id]
#supplier = @job.supplier
respond_to do |format|
if @job.save
format.html { redirect_to(params[:job][:job_id].present? ? supplier_job_path(params[:supplier_id], params[:job][:job_id]) : supplier_jobs_url(params[:supplier_id]), :notice => 'Job was successfully created.') }
format.xml { render :xml => @job, :status => :created, :location => @job }
else
format.html { render :action => "new" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_job xml, name\n\t\t\tputs \"==> Creating job for project: '#{name}'\"\n\t\t\tbegin\n\t\t\t\tcreate_response = RestClient.post \"#{@jenkins_host}:#{@jenkins_port}/createItem/?name=#{name}\", xml , {:content_type => :xml}\n\t\t\t\treturn create_response.code.to_s\n\t\t\trescue Exception => e\n\t\t\t\tputs... | [
"0.6847216",
"0.6769806",
"0.6390787",
"0.6271662",
"0.62408996",
"0.623112",
"0.6220346",
"0.62202764",
"0.61930704",
"0.61842257",
"0.61842257",
"0.61842257",
"0.61842257",
"0.6176608",
"0.6159866",
"0.61387354",
"0.61259687",
"0.6044265",
"0.60097986",
"0.60044014",
"0.598... | 0.0 | -1 |
PUT /jobs/1 PUT /jobs/1.xml | def update
@job = Job.find(params[:id])
#@job.last_finish = nil
@job.started_once = false
respond_to do |format|
if @job.update_attributes(params[:job])
if @job.childs
recursive_change_supplier(@job, @job.supplier)
end
format.html { redirect_to(@job.parent.present? ? supplier_job_path(params[:supplier_id], @job.parent.id) : supplier_jobs_path(params[:supplier_id]), :notice => 'Задача успешно обновлена') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @job.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"d... | [
"0.6630085",
"0.6558216",
"0.6558216",
"0.6558216",
"0.6536446",
"0.65334105",
"0.64888644",
"0.6390682",
"0.63784367",
"0.6359745",
"0.6359351",
"0.6359351",
"0.6359351",
"0.6358652",
"0.6320766",
"0.6320766",
"0.61899805",
"0.61413044",
"0.61285007",
"0.6108961",
"0.6103982... | 0.5726788 | 65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.