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 |
|---|---|---|---|---|---|---|
PDF Reader raw content returns only 1 line if the version is not compatible for direct text conversion | def pdf_ver_ok?(file)
reader = PDF::Reader.new(file)
(reader.page(1).raw_content.lines.count != 1) ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reader\n PdfReader.new @data.to_java_bytes\n end",
"def content_lines\n lines = []\n\n reader.pages.each do |page|\n page.text.split(\"\\n\").each do |line|\n if line =~ RE_FIRST_COLUMN_IS_NUMBER\n lines << line\n end\n end\n end\n\n line... | [
"0.6380592",
"0.60895795",
"0.5978116",
"0.5971416",
"0.59630984",
"0.5961016",
"0.59423286",
"0.59148353",
"0.5791985",
"0.5754491",
"0.57443964",
"0.5712425",
"0.57090175",
"0.5680559",
"0.5589987",
"0.55729324",
"0.5550724",
"0.5536127",
"0.5523511",
"0.5522823",
"0.549920... | 0.57661974 | 9 |
Three 1's => 1000 points Three 6's => 600 points Three 5's => 500 points Three 4's => 400 points Three 3's => 300 points Three 2's => 200 points One 1 => 100 points One 5 => 50 point A single die can only be counted once in each roll. For example, a "5" can only count as part of a triplet (contributing to the 500 point... | def score( dice )
total = []
one_and_five = [[1000, 100], [500, 50]]
[1, 5].each_with_index do |e, i|
arr_size = dice.select {|s| s == e}.size
if arr_size > 0
if arr_size == 3
total << one_and_five[i][0]
elsif arr_size < 3
total << one_and_five[i][1] * arr_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(dice)\n score = 0\n # n refers to an array which members are non-special die faces except when occurring three times in a roll of three or more.\n n = [2,3,4,6]\n # Creates an empty hash referred to as scorer with default value of zero\n scorer = Hash.new(0)\n # Iterates through the dice roll and c... | [
"0.776632",
"0.7663969",
"0.7564781",
"0.749718",
"0.74704486",
"0.7411963",
"0.7356414",
"0.7334155",
"0.73173195",
"0.728076",
"0.71884817",
"0.71733546",
"0.7160828",
"0.710989",
"0.70486355",
"0.6983425",
"0.6983425",
"0.69305146",
"0.69182694",
"0.6851818",
"0.6826912",
... | 0.74032223 | 6 |
Override this to disable required owner | def owner_required?
!Refinery::Multisites.user_class.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_ownership\n run_baby_run 'diskutil', ['disableOwnership', self.dev_node], :sudo => true\n end",
"def disabled!\n self\n end",
"def disable\n end",
"def disabled; end",
"def disable!\n @disabled = true\n end",
"def disable!\n self.enabled = false\n end",
... | [
"0.6993483",
"0.63681656",
"0.63174915",
"0.62643754",
"0.6219843",
"0.6205177",
"0.61999583",
"0.61304355",
"0.6106343",
"0.60638607",
"0.60226315",
"0.60173446",
"0.601613",
"0.601613",
"0.60131544",
"0.60079646",
"0.59563607",
"0.59510887",
"0.5940254",
"0.593423",
"0.5889... | 0.0 | -1 |
GET /account_features GET /account_features.xml | def index
@account_features = AccountFeature.find(:all, :order => 'position ASC')
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @account_features.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @account_feature = AccountFeature.find(params[:id])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @account_feature.to_xml }\n end\n end",
"def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html... | [
"0.74596894",
"0.63132536",
"0.6127663",
"0.6070788",
"0.60365623",
"0.601376",
"0.6007108",
"0.6006198",
"0.59228885",
"0.59169775",
"0.59083885",
"0.59074926",
"0.5897007",
"0.58778584",
"0.5823335",
"0.57927334",
"0.57926196",
"0.5779642",
"0.5771872",
"0.57415295",
"0.570... | 0.70193154 | 1 |
GET /account_features/1 GET /account_features/1.xml | def show
@account_feature = AccountFeature.find(params[:id])
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @account_feature.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @account_features = AccountFeature.find(:all, :order => 'position ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @account_features.to_xml }\n end\n end",
"def index\n @features = Feature.all\n\n respond_to do |format|\n forma... | [
"0.6908743",
"0.6268773",
"0.6202186",
"0.61767024",
"0.61722064",
"0.6162079",
"0.6092149",
"0.6066615",
"0.6025524",
"0.60034627",
"0.59243876",
"0.582886",
"0.5794279",
"0.5794279",
"0.5794279",
"0.57898235",
"0.57693094",
"0.57547724",
"0.5749226",
"0.5743874",
"0.5742081... | 0.7466626 | 0 |
POST /account_features POST /account_features.xml | def create
@account_feature = AccountFeature.new(params[:account_feature])
respond_to do |format|
if @account_feature.save
flash[:notice] = 'AccountFeature was successfully created.'
format.html { redirect_to [:admin, @account_feature] }
format.xml do
header... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n feature = features.create(feature_params)\n\n respond_with(feature)\n end",
"def create\n feature = features.create... | [
"0.6002293",
"0.59109586",
"0.59109586",
"0.5845783",
"0.58012325",
"0.57810843",
"0.5764281",
"0.57425666",
"0.57037127",
"0.5683575",
"0.56718963",
"0.5609416",
"0.5566537",
"0.5478742",
"0.5463451",
"0.5452861",
"0.54338247",
"0.54041564",
"0.53567475",
"0.5346278",
"0.534... | 0.7214425 | 0 |
PUT /account_features/1 PUT /account_features/1.xml | def update
@account_feature = AccountFeature.find(params[:id])
respond_to do |format|
if @account_feature.update_attributes(params[:account_feature])
format.html { redirect_to [:admin, @account_feature] }
format.xml { render :nothing => true }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @account_feature = AccountFeature.new(params[:account_feature])\n \n respond_to do |format|\n if @account_feature.save\n flash[:notice] = 'AccountFeature was successfully created.'\n \n format.html { redirect_to [:admin, @account_feature] }\n format.xml do\n ... | [
"0.6269979",
"0.6025294",
"0.5945905",
"0.58283484",
"0.58271056",
"0.5812744",
"0.5776626",
"0.5754831",
"0.5698728",
"0.567798",
"0.5660011",
"0.56595457",
"0.5656152",
"0.56056064",
"0.55997",
"0.5573366",
"0.5563859",
"0.5542618",
"0.5503049",
"0.5482995",
"0.54672337",
... | 0.71435827 | 0 |
DELETE /account_features/1 DELETE /account_features/1.xml | def destroy
@account_feature = AccountFeature.find(params[:id])
@account_feature.destroy
respond_to do |format|
format.html { redirect_to admin_account_features_url }
format.xml { render :nothing => true }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTP... | [
"0.6692834",
"0.6591562",
"0.6457013",
"0.6375604",
"0.63178533",
"0.6287993",
"0.6212043",
"0.61517614",
"0.6121212",
"0.61166877",
"0.61135167",
"0.6112636",
"0.6079685",
"0.60775393",
"0.60601616",
"0.60594845",
"0.60557514",
"0.5999063",
"0.599811",
"0.599811",
"0.599811"... | 0.7223656 | 0 |
Looks up the broker indexed by the given id | def [](id)
@by_id[id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(id, broker)\n @by_id[id] = broker\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def find(id)\n found_id = redis.get \"... | [
"0.6921756",
"0.6647334",
"0.6613162",
"0.6613162",
"0.6097717",
"0.6096803",
"0.6032092",
"0.6009468",
"0.59216505",
"0.5849824",
"0.5824618",
"0.58202803",
"0.5809834",
"0.5809668",
"0.5805726",
"0.5804012",
"0.5757385",
"0.574009",
"0.5730599",
"0.571524",
"0.5669697",
"... | 0.5439945 | 54 |
Indexes the broker with the given name | def []=(id, broker)
@by_id[id] = broker
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brokers = Broker.all\n end",
"def index\n @brokers = Broker.all\n end",
"def index(name)\n query\n @options[:index_name] = name.to_s\n self\n end",
"def index_by_name(table_name, index_name)\n index_record = data_dictionary.index_by_name(tab... | [
"0.6349022",
"0.6349022",
"0.63266605",
"0.62663347",
"0.59850967",
"0.5892144",
"0.57144076",
"0.5672219",
"0.56390667",
"0.56390667",
"0.560772",
"0.5590196",
"0.5573722",
"0.55339974",
"0.55104274",
"0.5503096",
"0.5498136",
"0.5498136",
"0.54919595",
"0.5488979",
"0.54830... | 0.0 | -1 |
Creates a broker with the given attributes | def create(attrs)
self << broker = Broker.new(attrs)
broker
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(attrs)\n self << topic = Topic.new(attrs)\n topic\n end",
"def create\n @broker = Broker.new(broker_params)\n\n respond_to do |format|\n if @broker.save\n format.html { redirect_to @broker, notice: 'Broker was successfully created.' }\n format.json { render :show,... | [
"0.62991637",
"0.62488836",
"0.6068082",
"0.6046999",
"0.59841484",
"0.58341146",
"0.5805945",
"0.57848066",
"0.5767112",
"0.5757053",
"0.575661",
"0.5736433",
"0.57245",
"0.5713946",
"0.5713946",
"0.57054454",
"0.5675806",
"0.56704026",
"0.5641298",
"0.5641298",
"0.56371325"... | 0.8626879 | 0 |
Adds the given broker, syncing it with any broker that exists with the same id | def <<(new_broker)
if new_broker.id
# Index by id, removing any existing index by uri
broker = self[new_broker.id] ||= @by_id.delete(new_broker.uri) || new_broker
else
# Index by URI
broker = self[new_broker.uri] ||= new_broker
end
broker.cluster = @cluster
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(id, broker)\n @by_id[id] = broker\n end",
"def register_broker(broker, identifier)\n registry.register broker, identifier\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_br... | [
"0.70491076",
"0.687135",
"0.6636785",
"0.6636785",
"0.6536283",
"0.5768719",
"0.5656196",
"0.56406343",
"0.5609808",
"0.53916466",
"0.53567386",
"0.5302798",
"0.52428627",
"0.4985206",
"0.4977395",
"0.4969817",
"0.4915049",
"0.48819956",
"0.48557532",
"0.48361757",
"0.483242... | 0.571065 | 6 |
Replaces the current collection of brokers with the given ones. Any brokers that intersect will remain in the collection. | def replace(brokers)
brokers = brokers.map {|broker| self << broker}
ids_to_remove = @by_id.keys - brokers.map(&:id)
ids_to_remove.each do |id|
broker = @by_id.delete(id)
broker.close
end
brokers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of, s) unless HULL_QUEUES.has_key?(s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of, s ... | [
"0.5485019",
"0.544057",
"0.4999535",
"0.49357706",
"0.49238664",
"0.49050248",
"0.4867002",
"0.48533133",
"0.48503792",
"0.48476824",
"0.484186",
"0.48225376",
"0.48215526",
"0.48176003",
"0.48162654",
"0.48078412",
"0.48042986",
"0.4802979",
"0.4792832",
"0.47632718",
"0.47... | 0.77847666 | 0 |
Enumerates over each broker | def each(&block)
@by_id.values.each(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brokers\n @brokers_mutex.synchronize do\n @brokers ||= begin\n brokers = zk.get_children(path: \"/brokers/ids\")\n\n if brokers.fetch(:rc) != Zookeeper::Constants::ZOK\n raise NoClusterRegistered, \"No Kafka cluster registered on this Zookeeper location.\"\n en... | [
"0.64720976",
"0.6251555",
"0.6204872",
"0.6204872",
"0.61784756",
"0.5833331",
"0.58163244",
"0.5807975",
"0.57937443",
"0.57774055",
"0.57423264",
"0.5708233",
"0.570543",
"0.56983864",
"0.56757253",
"0.566355",
"0.5648862",
"0.56414205",
"0.5637573",
"0.55287856",
"0.54981... | 0.0 | -1 |
seats[row][col] = seat y x | def part1()
@seats = @input.map(&:dup)
until rules_part1() == 0
end
count = 0
@seats.each { |row| count += row.count('#') }
count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seat_point(row_num,col_num,weight_non_movies=1)\n (is_movie? ? point_per_movie_seat_row(row_num) + point_column(col_num) : (weight_non_movies)*point_per_non_movie_seat_row(row_num)) + point_column(col_num)\n end",
"def seat_point_chart\n hold=[]\n availableSeats.to_a.each do |i| \n ... | [
"0.6679169",
"0.65553474",
"0.5952828",
"0.5911969",
"0.5894761",
"0.58578783",
"0.58003",
"0.5795857",
"0.5756811",
"0.57487524",
"0.572421",
"0.5722116",
"0.57215583",
"0.57215583",
"0.57215583",
"0.57215583",
"0.5705189",
"0.56998134",
"0.56927973",
"0.5680793",
"0.5639633... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def redeem_params
params.require(:redeemed_coupon).permit(:client_name, :client_email, :coupon_id)
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.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
Check if Database exists | def check_database_exists(db, db_name)
return if db.collections.include?(db_name)
flash[:danger] = I18n.t('database_not_found', database: db_name)
redirect '/'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_exists? db_name\n File.exists? db_name\n end",
"def database_exists?\n exists = File.file?(@database_path)\n raise \"Database does not exist: #{@database_path}\" unless exists\n\n exists\n end",
"def database_exists?(name)\n database = ::MySQL::Database.find_by_name(name)\n ... | [
"0.84624326",
"0.8417788",
"0.827349",
"0.8223142",
"0.8014003",
"0.7886917",
"0.78653306",
"0.7852969",
"0.78168017",
"0.7654112",
"0.7626868",
"0.74698615",
"0.7300405",
"0.70973045",
"0.70423234",
"0.7039577",
"0.70058614",
"0.69379675",
"0.69379675",
"0.69113743",
"0.6820... | 0.77735835 | 9 |
Check if Collection exists | def check_collection_exists(db, db_name, collection_name)
return if db.collections[db_name].include?(collection_name)
flash[:danger] = I18n.t('collection_not_found', collection: collection_name)
redirect "/db/#{db_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_collection?(name)\n has_coll name\n end",
"def isCollectionExists(collection_name,collection_list)\n collection_list.each do |collection|\n if collection_name == collection\n return true\n end\n end\n return false\n end",
"def check_exists(collection, da... | [
"0.85285115",
"0.77392316",
"0.75526303",
"0.7485311",
"0.7454648",
"0.74527085",
"0.735786",
"0.72690994",
"0.72359836",
"0.7213115",
"0.71768516",
"0.71393144",
"0.70864916",
"0.7047481",
"0.702954",
"0.70030504",
"0.6988164",
"0.6988164",
"0.6988164",
"0.6945063",
"0.69337... | 0.7307835 | 7 |
This challenge took me [] hours. Pseudocode =begin DEFINE method super_fizzbuzz, which takes in 1 agrument, an array For each item in the array IF the item is divisible by 3 & 5 set the item equal to "FizzBuzz" ELSIF the item is divisible by 3 set the item equal to "Fizz" ELSIF the item is divisible by 5 set the item e... | def super_fizzbuzz(array)
array.map!{|item|
if item % 3 == 0 && item % 5 == 0
item = "FizzBuzz"
elsif item % 3 == 0
item = "Fizz"
elsif item % 5 == 0
item = "Buzz"
else item = item
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def super_fizzbuzz(array)\n\t# this iterator will keep track of the location of the current element\n\ti = 0 \n\n\t# go through each item in the array\n\tarray.each do |x| \n\t\t# see if it is divisible by 3 \t\t\n\t\tif (x % 3 == 0)\n\t\t\t# see if it is divisible by 15\n\t\t\tif (x % 15 == 0)\n\t\t\t\tarray[i] =... | [
"0.84842527",
"0.83623374",
"0.83468926",
"0.832268",
"0.83140427",
"0.81946707",
"0.81873024",
"0.818337",
"0.8140607",
"0.81206083",
"0.810132",
"0.80965847",
"0.80931616",
"0.8077105",
"0.80740875",
"0.80732834",
"0.80542886",
"0.80441016",
"0.80337036",
"0.802583",
"0.801... | 0.83967733 | 1 |
This logs out the user, change it to whatever your logout method will be | def logout
"/users/logout"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
... | [
"0.8787102",
"0.8764571",
"0.8764571",
"0.8764571",
"0.8764571",
"0.8764489",
"0.8756028",
"0.87405175",
"0.87132776",
"0.8703507",
"0.8693407",
"0.86930805",
"0.8660043",
"0.8660043",
"0.8660043",
"0.8660043",
"0.8660043",
"0.86550176",
"0.86387473",
"0.86386335",
"0.8638049... | 0.0 | -1 |
User login page, change Path if need be | def user_login
"/users/login"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loginpage\n end",
"def login_path\n root_path\n end",
"def login_page\n end",
"def login \n @user = User.new\n @current_uri = request.env['PATH_INFO']\n render \"users/new\", :layout => \"signup_login\"\n end",
"def login\n redirect_to lato_core.root_path if core_co... | [
"0.7652474",
"0.74034816",
"0.7389431",
"0.7202954",
"0.712407",
"0.70789",
"0.7032264",
"0.7010131",
"0.70025355",
"0.69904304",
"0.69760233",
"0.6974953",
"0.6901998",
"0.689505",
"0.6890741",
"0.6887002",
"0.68605334",
"0.6850027",
"0.6850027",
"0.6850027",
"0.6850027",
... | 0.7247811 | 3 |
User Creations page, change Path if need be | def user_new
"/users/new"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user = User.new(params[:user])\n # TODO process errors\n # TODO create folder\n # TODO create record in Folder\n if @user.save\n Dir.mkdir(Dir.pwd+\"/app/assets/images/from_users/\"+@user.id.to_s)\n render :partial => \"/users/create\"\n else\n render :partial => \"/u... | [
"0.67008054",
"0.63938224",
"0.6368851",
"0.63119453",
"0.6298834",
"0.6295188",
"0.6202446",
"0.6167582",
"0.61599416",
"0.61583424",
"0.6094929",
"0.6082591",
"0.60771513",
"0.6052454",
"0.6044071",
"0.6033776",
"0.6033139",
"0.6024907",
"0.60133487",
"0.6001229",
"0.599051... | 0.62963057 | 5 |
GET /financial_reports GET /financial_reports.json | def index
@financial_reports = @company.financial_reports.annual.recent.include_statements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def index\n @financials = Financial.search(params, 50)\n end",
"def get_financials\n render json: [current_user]\n end",
"def index\n @monthly_finances = Mon... | [
"0.715797",
"0.70293605",
"0.7000144",
"0.6971273",
"0.6876466",
"0.68446034",
"0.6827199",
"0.68050003",
"0.6700515",
"0.6697282",
"0.6634627",
"0.66320384",
"0.66252595",
"0.6589542",
"0.65596193",
"0.6546651",
"0.6457539",
"0.64495003",
"0.6369537",
"0.6364774",
"0.6359498... | 0.73359704 | 0 |
Returns the Nest key of this schedule. Later[:reservations].key => Later:reservations | def key
@key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_key(keyspace, timestamp)\n keyspace.key(self.format(timestamp))\n end",
"def resident_key; end",
"def get_key\n return nil if @available_keys.empty?\n key = -1\n @mutex.synchronize do\n key = @available_keys.shift[0]\n @keys[key][:ct] = Time.now.to_i\n end\n key\n end... | [
"0.59764934",
"0.58557105",
"0.57338715",
"0.5721945",
"0.5695521",
"0.56217796",
"0.5594817",
"0.55679077",
"0.556602",
"0.5561338",
"0.5544619",
"0.5503375",
"0.5503375",
"0.54937863",
"0.54736525",
"0.5468551",
"0.54643834",
"0.5447918",
"0.544129",
"0.5439795",
"0.5423623... | 0.5429082 | 21 |
Returns the Nest key of this schedule's exception list. Later[:reservations].exceptions => Later:reservations:exceptions | def exceptions
@exceptions ||= key[:exceptions]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exceptions\n @values['exceptions']\n end",
"def user_exceptions\n individuals.map {|k, v| k if v == 'exceptions'}.compact \n end",
"def group_exceptions\n rightsMetadata.groups.map {|k, v| k if v == 'exceptions'}.compact\n end",
"def exception_set\n return @child... | [
"0.603156",
"0.57192194",
"0.5696694",
"0.56035155",
"0.5585304",
"0.5547693",
"0.5426425",
"0.5371033",
"0.52897197",
"0.52897197",
"0.52737945",
"0.5262866",
"0.52552545",
"0.5250809",
"0.5245222",
"0.5215462",
"0.51209027",
"0.5040231",
"0.5026157",
"0.5016759",
"0.5010815... | 0.62496406 | 0 |
Returns the time of a scheduled unique event. Later[:reservations].set 'event1', Time.parse('20120928 11:36:17 +0800') Later[:reservations]['event1'] => 20120928 11:36:17 +0800 | def [](event)
Time.at key[:schedule].zscore(event) rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(event, time)\n key[:schedule].zadd time.to_f, event\n end",
"def next_time\n\n schedule_info\n end",
"def trip_time\n # puts scheduled_date.ai\n # puts scheduled_time.ai\n # DateTime.new(scheduled_date.year, scheduled_date.month, scheduled_date.day,\n # scheduled_time.... | [
"0.6090662",
"0.5597301",
"0.55919737",
"0.54835033",
"0.5385337",
"0.5264795",
"0.52256835",
"0.52160424",
"0.5187476",
"0.5130612",
"0.5120749",
"0.5120697",
"0.5096459",
"0.50933313",
"0.5084435",
"0.5084435",
"0.5079037",
"0.5072539",
"0.50717187",
"0.5041868",
"0.5040542... | 0.5436466 | 4 |
Returns the number of scheduled unique events. Later[:reservations].set 'event1', Time.now + 60 Later[:reservations].set 'event2', Time.now + 120 Later[:reservations].set 'event3', Time.now + 180 Later[:reservations].count => 3 | def count
key[:schedule].zcard
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_reservations\n reservations.count\n end",
"def release_stale_reservations\n unreserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>0}).count\n reserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>{:$gt=>0}}).count\n log_yellow \... | [
"0.623021",
"0.6013039",
"0.58461386",
"0.5725791",
"0.57144237",
"0.5676064",
"0.5647231",
"0.55867994",
"0.55789495",
"0.5561595",
"0.547429",
"0.54209745",
"0.53568053",
"0.5328337",
"0.5306561",
"0.5279158",
"0.52289826",
"0.522579",
"0.5225542",
"0.52040243",
"0.52027863... | 0.5522825 | 10 |
Returns `true` if there are no scheduled unique events. Returns `false` otherwise. Later[:reservations].set 'event1', Time.now + 60 Later[:reservations].empty? => false Later[:reservations].unset 'event1' Later[:reservations].empty? => true | def empty?
count.zero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeslot_contains_reservations?\n return start_dt.blank? || end_dt.blank? || existing_reservations?\n end",
"def existing_reservations?\n !existing_reservations.empty?\n end",
"def release_stale_reservations\n unreserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>0}).co... | [
"0.64264375",
"0.63851917",
"0.58520365",
"0.58009845",
"0.57896054",
"0.57445765",
"0.57363766",
"0.5734847",
"0.5732218",
"0.5720029",
"0.5698496",
"0.5696458",
"0.5678074",
"0.56534165",
"0.5642041",
"0.5637389",
"0.5636219",
"0.5636219",
"0.56014705",
"0.5598029",
"0.5562... | 0.0 | -1 |
Sets a unique event to this schedule. Later[:reservations].set 'event1', Time.now + 60 | def set(event, time)
key[:schedule].zadd time.to_f, event
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_scheduled_event\n @scheduled_event = ScheduledEvent.find(params[:id])\n end",
"def handle_reserve_pressed(room, events)\n # check if should extend reso or make new\n if room.next_start && room.next_end && room.next_start < Time.now && room.next_end > Time.now\n # extend endtime of curr... | [
"0.5930741",
"0.57431245",
"0.5729496",
"0.5669941",
"0.5609164",
"0.5571454",
"0.5468148",
"0.54670966",
"0.54602623",
"0.5449306",
"0.54452336",
"0.5440519",
"0.5438043",
"0.5425919",
"0.5409399",
"0.5407451",
"0.5356019",
"0.534541",
"0.5342322",
"0.53203",
"0.52914715",
... | 0.65785944 | 0 |
Unsets a unique event from this schedule. Later[:reservations].unset 'event1' | def unset(event)
key[:schedule].zrem event
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unevent(name)\n Events.remove(name)\n end",
"def remove_event(event)\n @events.delete(event)\n end",
"def remove_one_event(event)\n client.execute(\n :api_method => calendar.events.delete,\n :parameters => {:calendarId => calendar_id, :eventId => event['id']})\n end",
"d... | [
"0.65576655",
"0.65513134",
"0.6386505",
"0.6311015",
"0.62399024",
"0.6108184",
"0.60959",
"0.60791147",
"0.607796",
"0.6041069",
"0.6009337",
"0.6009337",
"0.6009337",
"0.59168965",
"0.5896299",
"0.58746254",
"0.586073",
"0.58537334",
"0.5776661",
"0.5769144",
"0.57635295",... | 0.7253004 | 0 |
When called inside an `each` block, `stop!` signals the block to halt processing of this schedule. Later[:reservations].each do |event| Later[:reservations].stop! end | def stop!
@stop = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n yield\n end",
"def on_stop(&block)\n @@on_stop_proc << block\n end",
"def stop(&blk)\n if blk\n Smith.stop(true, &blk)\n else\n Smith.stop(true)\n end\n end",
"def stop(&block)\n @stop = block\n end",
"def stop\n get_scheduler.unschedu... | [
"0.6571505",
"0.6470583",
"0.63444227",
"0.6311994",
"0.6283213",
"0.62256503",
"0.61870414",
"0.6168091",
"0.61490196",
"0.6137995",
"0.6098316",
"0.6092804",
"0.60743004",
"0.60617554",
"0.60132253",
"0.6004672",
"0.59848386",
"0.59809065",
"0.596137",
"0.59587896",
"0.5952... | 0.57868856 | 33 |
Processes each scheduled unique event. The block only gets called when an event is due to run based on the current time. Accepts an optional `timeout` parameter with a default value of `1`. Passing an `Integer` will use Redis' blocking mechanism to process the schedule and is therefore more efficient. Passing a `Float`... | def each(timeout = 1, &block)
@stop = false
loop do
break if stop?
time = Time.now.to_f
push_to_queue pop_from_schedules(time)
next unless event = pop_from_queue(timeout)
begin
block.call event
rescue Exception => e
exceptions.rpush JSO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(timeout: nil)\n @deadline = Time.now + timeout if timeout\n\n while true\n # prevent any intervening messages from being processed and discarded before we're back in Celluloid.receive()\n Celluloid.exclusive {\n if error?\n debug { \"raise: #{self.describe_obser... | [
"0.6084339",
"0.5955507",
"0.56483036",
"0.5604775",
"0.55541736",
"0.5508253",
"0.5480292",
"0.5466275",
"0.5397727",
"0.5377759",
"0.53755766",
"0.5341601",
"0.5301277",
"0.52793074",
"0.5221903",
"0.5162643",
"0.51544803",
"0.50603575",
"0.5058174",
"0.5048665",
"0.5042691... | 0.74572533 | 0 |
Create restful routes if they aren't taken already. | def defaults default_verb=nil
default_verb = (default_verb || 'get').to_s.downcase
(@ctrl.actions - @actions).each do |action|
verb, path = DEFAULT_ACTION_MAP[action]
verb, path = [default_verb, "/#{action}"] if verb.nil?
add(verb, action, path) unless verb.nil? ||
@route... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_routes\n\t\t\t\t\t[\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :index },\n\t\t\t\t\t\t{ method: :POST, path: '/', action: :create },\n\t\t\t\t\t\t{ method: :GET, path: '/', action: :show },\n\t\t\t\t\t\t{ method: :PUT, path: '/', action: :update },\n\t\t\t\t\t\t{ method: :DELETE... | [
"0.69008034",
"0.6626315",
"0.6621366",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.6590521",
"0.65332454",
"0.6506032",
"0.6506032",
"0.6475806",
"0.64461625",
"0.63420993",
"0.63323694"... | 0.0 | -1 |
Add a Controller to the router with a base path. | def add ctrl, base_path=nil, &block
base_path ||= ctrl.controller_name
mount = Mount.new(ctrl, base_path, @sep, &block)
mount.each_route do |route_ary, name, val|
curr_node = @routes_tree
route_ary.each do |part|
curr_node.add_child part
curr_node = curr_node[part]
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_route path, controller, &block\n\t\t\t\t@active_host ||= add_host :default\n\t\t\t\t@active_host.routes << ::Plezi::Base::Route.new(path, controller, &block)\n\t\t\tend",
"def route\n @base_controller.route if @base_controller\n end",
"def map prefix, controller\n Route.register_controller... | [
"0.68292886",
"0.6645479",
"0.6513802",
"0.64125794",
"0.63567746",
"0.6168124",
"0.6168124",
"0.61345285",
"0.6122395",
"0.61138254",
"0.6090073",
"0.60052055",
"0.5994606",
"0.5963934",
"0.5943711",
"0.5876798",
"0.58644515",
"0.582624",
"0.5742245",
"0.55969507",
"0.558960... | 0.72373635 | 0 |
Check if a Controller and action combo has a route. | def has_route? ctrl, action
!!@routes_lookup[[ctrl, action]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binder_routing_ok?(binder, action)\n\n\t\treturn request.path[0..named_binder_route(binder, action).size - 1] == named_binder_route(binder, action)\n\n\tend",
"def allow_route?(route)\n introspector.controllers.include?(route[:controller]) &&\n controller_matches.all? { |regexp| route[:contro... | [
"0.72114074",
"0.7209144",
"0.69746035",
"0.6951638",
"0.6897136",
"0.6897136",
"0.68250185",
"0.6749627",
"0.66320705",
"0.6572796",
"0.65405375",
"0.65341616",
"0.65259147",
"0.65117097",
"0.65002716",
"0.64946103",
"0.64837426",
"0.6368849",
"0.63165045",
"0.6286583",
"0.6... | 0.8055023 | 0 |
Yield every Controller, action, route combination. | def each_route &block
@routes_lookup.each do |key,route|
next unless Array === key
block.call route, key[0], key[1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n @routes.each do |rt|\n yield rt\n end\n self\n end",
"def each(*args)\n routes.each(*args)\n end",
"def each_route(&block)\n\t\tget_routes().each(&block)\n\tend",
"def routes(&block); end",
"def routes(&block); end",
"def each(&block)\n _init\n\n routes.each(&b... | [
"0.72910565",
"0.6787964",
"0.66484904",
"0.6516319",
"0.6516319",
"0.6515747",
"0.6388985",
"0.6238479",
"0.61584926",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.6095743",
"0.5984739",
... | 0.60531783 | 20 |
Takes a path and returns an array of 3 items: [controller_class, action_symbol, path_params_hash] Returns nil if no match was found. | def resources_for http_verb, path
param_vals = []
curr_node = @routes_tree[http_verb.to_s.downcase]
return unless curr_node
path.scan(%r{/([^/]+|$)}) do |(key)|
next if key.empty?
if curr_node[key]
curr_node = curr_node[key]
elsif curr_node["%s"]
param_vals << key
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_path(path)\n path_hash = Rails.application.routes.recognize_path(path)\n return path_hash[:controller], path_hash[:action]\n end",
"def params_for_path(path)\n routes.each do |route|\n # TODO: Finish nested routes\n if false && route[0].class == Proc\n # puts route[0].call(pa... | [
"0.7183359",
"0.6530931",
"0.6207238",
"0.618682",
"0.6086659",
"0.60524845",
"0.59118694",
"0.5906275",
"0.5771849",
"0.57217735",
"0.5642871",
"0.5594827",
"0.5534603",
"0.54870033",
"0.54852694",
"0.5472801",
"0.5461167",
"0.54433197",
"0.54224575",
"0.5418467",
"0.5386860... | 0.55280143 | 13 |
GET /implements/1 GET /implements/1.json | def show
@implement = Implement.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @implement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface\n respond_to do |format|\n format.json {}\n end\n end",
"def show\n @interface = Interface.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @interface }\n end\n end",
"def included_interfaces; end",
"def i... | [
"0.6790557",
"0.61953735",
"0.5987505",
"0.59354067",
"0.57820314",
"0.5746248",
"0.5732451",
"0.5732451",
"0.56905514",
"0.56398356",
"0.56391245",
"0.55058855",
"0.54865015",
"0.5483036",
"0.5470674",
"0.5470231",
"0.5420428",
"0.53613",
"0.5347768",
"0.5346611",
"0.5337973... | 0.62998 | 1 |
GET /implements/new GET /implements/new.json | def new
@implement = Implement.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @implement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @interface = Interface.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interface }\n end\n end",
"def new\n @interface = Interface.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @i... | [
"0.71878576",
"0.7163559",
"0.6777141",
"0.67458075",
"0.67153186",
"0.6646498",
"0.6541552",
"0.65270185",
"0.6454281",
"0.6432226",
"0.6418067",
"0.6334205",
"0.63304675",
"0.63105404",
"0.62799096",
"0.62562907",
"0.6247693",
"0.62406945",
"0.6208206",
"0.6201312",
"0.6188... | 0.7435199 | 0 |
POST /implements POST /implements.json | def create
@implement = Implement.new(params[:implement])
respond_to do |format|
if @implement.save
format.html { redirect_to @implement, notice: 'Implement was successfully created.' }
format.json { render json: @implement, status: :created, location: @implement }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface\n respond_to do |format|\n format.json {}\n end\n end",
"def implements?() \n return true if self[:implements].length > 0\n end",
"def write_interface(data)\n uri = URI(@baseURL)\n\n # debug output\n if (@testFlag)\n # print hash of request headers instea... | [
"0.6099705",
"0.58741254",
"0.57617944",
"0.57106173",
"0.57089937",
"0.57089937",
"0.5637727",
"0.56154823",
"0.56071216",
"0.5542937",
"0.5531314",
"0.5516279",
"0.54901487",
"0.54780805",
"0.5471809",
"0.54196906",
"0.54196906",
"0.5397875",
"0.5397875",
"0.53842086",
"0.5... | 0.59197634 | 1 |
PUT /implements/1 PUT /implements/1.json | def update
@implement = Implement.find(params[:id])
respond_to do |format|
if @implement.update_attributes(params[:implement])
format.html { redirect_to @implement, notice: 'Implement was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put\n raise NotImplementedError\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def put(request, response)\n NotImplemented\n end",
"def put(request, response)\n NotImplemented\n end",
"def put(uri, request_headers, body)\n raise NotImplementedError... | [
"0.6306666",
"0.6003843",
"0.59689707",
"0.59689707",
"0.596468",
"0.5950437",
"0.5835008",
"0.57926583",
"0.57780665",
"0.57479286",
"0.57240015",
"0.5691093",
"0.568011",
"0.5662851",
"0.5652129",
"0.5614478",
"0.5600045",
"0.5580471",
"0.5564329",
"0.55411136",
"0.5538498"... | 0.5971372 | 2 |
DELETE /implements/1 DELETE /implements/1.json | def destroy
@implement = Implement.find(params[:id])
@implement.destroy
respond_to do |format|
format.html { redirect_to implements_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @interface = Interface.find(params[:id])\n @interface.destroy\n\n respond_to do |format|\n format.html { redirect_to interfaces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @implement = Implement.find(params[:id])\n @implement.destroy\n\n res... | [
"0.6976287",
"0.6949899",
"0.691976",
"0.691976",
"0.6773485",
"0.6665658",
"0.65759915",
"0.6558071",
"0.65502405",
"0.647018",
"0.6447827",
"0.6405757",
"0.6403234",
"0.6391775",
"0.6385082",
"0.6385082",
"0.6385082",
"0.6385082",
"0.6355857",
"0.6343069",
"0.63406503",
"... | 0.7149968 | 0 |
GET /pollbooths GET /pollbooths.json | def index
@pollbooths = Pollbooth.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pollbooth\n @pollbooth = Pollbooth.find(params[:id])\n end",
"def create\n @pollbooth = Pollbooth.new(pollbooth_params)\n\n respond_to do |format|\n if @pollbooth.save\n format.html { redirect_to @pollbooth, notice: 'Pollbooth was successfully created.' }\n format.json { ... | [
"0.70677716",
"0.6479332",
"0.5993966",
"0.58653146",
"0.5712264",
"0.56480294",
"0.5621323",
"0.5619203",
"0.5572802",
"0.5572802",
"0.5572802",
"0.5572802",
"0.5572802",
"0.55508053",
"0.5494817",
"0.54848754",
"0.5427809",
"0.54211736",
"0.53886163",
"0.53793037",
"0.53766... | 0.76250434 | 0 |
GET /pollbooths/1 GET /pollbooths/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pollbooths = Pollbooth.all\n end",
"def set_pollbooth\n @pollbooth = Pollbooth.find(params[:id])\n end",
"def create\n @pollbooth = Pollbooth.new(pollbooth_params)\n\n respond_to do |format|\n if @pollbooth.save\n format.html { redirect_to @pollbooth, notice: 'Pollboo... | [
"0.756135",
"0.7436641",
"0.68260825",
"0.6377157",
"0.6053067",
"0.58883494",
"0.5810083",
"0.57945627",
"0.5719494",
"0.5655856",
"0.5655493",
"0.5655493",
"0.5655493",
"0.5655493",
"0.5655493",
"0.5653583",
"0.5639488",
"0.5634627",
"0.5589033",
"0.5570479",
"0.5559403",
... | 0.0 | -1 |
POST /pollbooths POST /pollbooths.json | def create
@pollbooth = Pollbooth.new(pollbooth_params)
respond_to do |format|
if @pollbooth.save
format.html { redirect_to @pollbooth, notice: 'Pollbooth was successfully created.' }
format.json { render :show, status: :created, location: @pollbooth }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pollbooth\n @pollbooth = Pollbooth.find(params[:id])\n end",
"def pollbooth_params\n params.require(:pollbooth).permit(:email, :answer)\n end",
"def index\n @pollbooths = Pollbooth.all\n end",
"def update\n respond_to do |format|\n if @pollbooth.update(pollbooth_params)\n ... | [
"0.6770776",
"0.6450732",
"0.62310654",
"0.6198748",
"0.5937686",
"0.580884",
"0.57508594",
"0.56682855",
"0.5596527",
"0.55486",
"0.53870404",
"0.5380453",
"0.5364087",
"0.5329138",
"0.5318352",
"0.5258626",
"0.5244743",
"0.52399",
"0.5236246",
"0.52245903",
"0.5223665",
"... | 0.7762339 | 0 |
PATCH/PUT /pollbooths/1 PATCH/PUT /pollbooths/1.json | def update
respond_to do |format|
if @pollbooth.update(pollbooth_params)
format.html { redirect_to @pollbooth, notice: 'Pollbooth was successfully updated.' }
format.json { render :show, status: :ok, location: @pollbooth }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pollbooth\n @pollbooth = Pollbooth.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @booth.update(booth_params)\n format.html { redirect_to event_booth_path(@booth), notice: 'Booth was successfully updated.' }\n format.json { render :show, status: :ok, loc... | [
"0.6631099",
"0.6335531",
"0.62396765",
"0.6234938",
"0.6136043",
"0.61359406",
"0.61075795",
"0.61075795",
"0.59925306",
"0.5965075",
"0.5949145",
"0.59433025",
"0.59307545",
"0.5927526",
"0.5911494",
"0.58974123",
"0.58933526",
"0.5887273",
"0.5886842",
"0.58826137",
"0.586... | 0.77315605 | 0 |
DELETE /pollbooths/1 DELETE /pollbooths/1.json | def destroy
@pollbooth.destroy
respond_to do |format|
format.html { redirect_to pollbooths_url, notice: 'Pollbooth was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pol.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n ... | [
"0.6830555",
"0.680408",
"0.67383265",
"0.6731097",
"0.6700343",
"0.65650076",
"0.65462285",
"0.6515914",
"0.6501508",
"0.6450148",
"0.6430201",
"0.64278734",
"0.6423376",
"0.6418887",
"0.6415083",
"0.64065623",
"0.6395462",
"0.639093",
"0.63887167",
"0.6371671",
"0.63563055"... | 0.7719741 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_pollbooth
@pollbooth = Pollbooth.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def pollbooth_params
params.require(:pollbooth).permit(:email, :answer)
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
It is normally this object that instructs the node stream to create unique nav nodes, but to satisfy interface, we have to define it. It might be better to ignore the parameter but there might be a use for it later, so I'll leave. | def set_unique_navigation_nodes(unique_navigation_nodes)
@input.set_unique_navigation_nodes(unique_navigation_nodes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_unique_navigation_nodes(unique_navigation_nodes)\n raise NotImplementedError\n end",
"def navigation_id=(_arg0); end",
"def initialize\n @nodes = []\n end",
"def node=(_arg0); end",
"def initialize\n @nodes = []\n end",
"def initialize\n @first_node = ni... | [
"0.6174103",
"0.59724677",
"0.5856468",
"0.58491206",
"0.5831585",
"0.5787367",
"0.5737831",
"0.5672733",
"0.5672733",
"0.56629777",
"0.5649622",
"0.5649622",
"0.56395596",
"0.56395596",
"0.56395596",
"0.56383556",
"0.5576204",
"0.55641454",
"0.55641454",
"0.55641454",
"0.556... | 0.5666182 | 9 |
Started GET "/session/new" for 127.0.0.1 at 20120926 14:51:42 0700 | def started_request_message(request, start_time = Time.now)
'Started %s "%s" for %s at %s' % [
request.request_method,
request.filtered_path,
request.ip,
start_time.to_default_s ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\r\n @session = Session.new\r\n @session.state = 'waiting'\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @session }\r\n format.json { render :json => @session }\r\n end\r\n end",
"def new\n @session = Session.new\n end",
"... | [
"0.72088283",
"0.7112195",
"0.70783544",
"0.6909134",
"0.6897197",
"0.6873879",
"0.6854381",
"0.68402225",
"0.6803919",
"0.67791295",
"0.67791295",
"0.67791295",
"0.67791295",
"0.67791295",
"0.67252576",
"0.6708769",
"0.66786975",
"0.6643001",
"0.6630221",
"0.6630181",
"0.660... | 0.0 | -1 |
1. (32 4) >= 129 => false 2. false != !true => false 3. true == 4 => false 4. false == (847 == "847") => true 5. (!true || (!(100 / 5) == 20) || ((328 /4) == 82)) || false => true Write method that takes string as argument... | def string_length(words)
if words.length >= 10
puts words.upcase!
else
puts "The string is not longer than 10"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bool_comparison() \n assert_equal(true, @@parser.test_run(\"\n bool chief():\n return 15 < 10^2 and 20 != 15*3\n end\"))\n\n assert_equal(false, @@parser.test_run(\"\n bool chief():\n return 100 < 10*2 or 15 + 25 < 30\n end\"))\n end",
"... | [
"0.61549115",
"0.59576356",
"0.5945787",
"0.59344184",
"0.58563495",
"0.5775448",
"0.5766643",
"0.57482743",
"0.5698553",
"0.5669271",
"0.5657866",
"0.56208324",
"0.561478",
"0.5605001",
"0.55909884",
"0.5588171",
"0.55697244",
"0.5565393",
"0.55555296",
"0.5552195",
"0.55440... | 0.0 | -1 |
Question 4 1. "FALSE" 2. "Did you get it right?" 3. "Alright now!" Rewrite number using case statement | def number_choice(num)
case num
when 0..50
puts "your number is between 0 and 50"
when 51..100
puts "your number is between 51 and 100"
else
puts "you provided a number that was not between 0 and 100"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test2 (number)\n answer2 = case number\n when 0..50\n \"Your number is between 0 and 50\"\n when 51..100\n \"Your number is between 50 and 100\"\n else\n if (number < 0)\n answer2 = \"Come on, the number has to be at least 0.\"\n elsif (number > 100)\n answer2 = \"Hey #{number} is abo... | [
"0.7255863",
"0.7156701",
"0.7027996",
"0.70119965",
"0.6936091",
"0.6898435",
"0.68377197",
"0.67827386",
"0.6761518",
"0.6731141",
"0.6728744",
"0.6710639",
"0.6700987",
"0.6691086",
"0.66834074",
"0.6679248",
"0.6678256",
"0.6668396",
"0.66674745",
"0.6667406",
"0.6646866"... | 0.6188877 | 87 |
returns the rank of the card optional short parameter will limit face cards to one character | def rank(short = false)
if (2..10) === @rank
@rank.to_s
else
h = { 11 => 'Jack', 12 => 'Queen', 13 => 'King', 14 => 'Ace' }
h[@rank] && short ? h[@rank][0] : h[@rank]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end",
"def rank_of_card_at(index)\n cards[index].rank\n end",
"def rank_of_cards_at(index)\n return cards[index].rank\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def s... | [
"0.74238425",
"0.71410245",
"0.706085",
"0.7039774",
"0.69277954",
"0.6841984",
"0.6736175",
"0.670189",
"0.6689666",
"0.6633648",
"0.66325957",
"0.6599718",
"0.650477",
"0.64582324",
"0.63927317",
"0.6363835",
"0.6354256",
"0.6343756",
"0.6266258",
"0.625087",
"0.6223354",
... | 0.7972636 | 0 |
returns the suit of a card optional glyph parameter displays a colored unicode character | def suit(glyph = false)
case @suit
when 1
glyph ? CLUB.black.bold : 'Clubs'
when 2
glyph ? DIAMOND.red : 'Diamonds'
when 3
glyph ? HEART.red : 'Hearts'
when 4
glyph ? SPADE.black.bold : 'Spades'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suit\n suit_array = [\"♦\",\"♣\",\"♠\",\"♥\"]\n end",
"def define_suit(card)\n suit = card[1]\n case suit\n when \"C\"\n return 'clubs'\n when \"D\"\n return 'diamonds'\n when \"H\"\n return 'hearts'\n when \"S\"\n return 'spades'\n end\nend",
"def symbol \n return \"♚\" if @colo... | [
"0.67955714",
"0.65905166",
"0.6579699",
"0.64622855",
"0.6388883",
"0.6303806",
"0.6273083",
"0.6272587",
"0.6257269",
"0.62429607",
"0.6210169",
"0.6182435",
"0.6146888",
"0.60726583",
"0.60682875",
"0.60371196",
"0.6020494",
"0.60068727",
"0.6006562",
"0.59988576",
"0.5983... | 0.8298331 | 0 |
returns the short rank, followed by suit icon | def short
"#{rank(true)}#{suit(true)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank(short = false)\n if (2..10) === @rank\n @rank.to_s\n else\n h = { 11 => 'Jack', 12 => 'Queen', 13 => 'King', 14 => 'Ace' }\n h[@rank] && short ? h[@rank][0] : h[@rank]\n end\n end",
"def to_s\n \"#{rank} of #{suit}\"\n end",
"def to_s\n \"#{rank} of #{suit... | [
"0.70670915",
"0.70456076",
"0.70456076",
"0.7017395",
"0.6845685",
"0.6794884",
"0.6731943",
"0.6727271",
"0.66921264",
"0.6660545",
"0.6583298",
"0.64315176",
"0.6423118",
"0.6389073",
"0.638788",
"0.6356076",
"0.633076",
"0.63092786",
"0.6308045",
"0.62935215",
"0.6293379"... | 0.7205823 | 0 |
returns the numerical representation of the rank | def to_i
@rank
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank_to_s\n\t\treturn self.class.rank_to_s\n\tend",
"def rank\n return @rank\n end",
"def rank\n return inv + neg + nsp\n end",
"def rank_to_s\n\t\t\tRankingName[rank]\n\t\tend",
"def rank_to_i(rank)\n case rank.to_s\n when /^(a|ace)/i; 14\n when /^(k|... | [
"0.8165051",
"0.7820964",
"0.7807024",
"0.75887764",
"0.7513557",
"0.741635",
"0.741635",
"0.73907316",
"0.7370984",
"0.7351826",
"0.72742003",
"0.72255296",
"0.7205575",
"0.71286017",
"0.7063931",
"0.70224804",
"0.6964649",
"0.6953472",
"0.68900174",
"0.6882011",
"0.6876027"... | 0.8675136 | 0 |
draws a card picture | def to_s
# A simple template with X's as placeholders
# YY represents the placement of the card's rank
template = <<-TPL.gsub(/^\s+/,'')
╭───────╮
| X X X |
| X X X |
| X YYX |
| X X X |
╰───────╯
TPL
# the patterns represent the configurati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend",
"def draw()\n if self.actor != nil\n bitmap = Cache.character(self.actor.character_name)\n sign = self.actor.character_name[/^[\\!\\$]./]\n if sign != nil && sign.include?('$')\n cw = bitmap.width / 3\n ch = bitmap.height /... | [
"0.7748285",
"0.7265761",
"0.7174731",
"0.70877784",
"0.7029547",
"0.69840527",
"0.69636214",
"0.69478",
"0.69467074",
"0.69399667",
"0.6926637",
"0.6920154",
"0.691896",
"0.68967545",
"0.68911356",
"0.6875117",
"0.68542635",
"0.68405145",
"0.6828966",
"0.6828966",
"0.6828966... | 0.0 | -1 |
converts the string representation of a rank to an integer | def rank_to_i(rank)
case rank.to_s
when /^(a|ace)/i; 14
when /^(k|king)/i; 13
when /^(q|queen)/i; 12
when /^(j|jack)/i; 11
when '10'; 10
when '2'..'9'; rank
else 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_i\n @rank\n end",
"def getValue(rank)\n\tif /\\d/.match(rank)\n\t\treturn rank.to_i\n\telsif rank == 'Ace'\n\t\treturn 11\n\telse\n\t\treturn 10\n\tend\nend",
"def rankval ( rank )\n if rank.is_a? Numeric\n return rank\n elsif rank ==\"J\"\n return (11)\n elsif rank ==\"Q\"\n return ... | [
"0.7629999",
"0.7022113",
"0.69578063",
"0.65677905",
"0.65488607",
"0.6472948",
"0.6326698",
"0.6313948",
"0.6310413",
"0.62591946",
"0.62426853",
"0.6231812",
"0.6193785",
"0.6153913",
"0.61270666",
"0.6107106",
"0.60408074",
"0.60252047",
"0.5995704",
"0.5994849",
"0.59923... | 0.8475326 | 0 |
converts the string representation of a suit to an integer suits are ordered alphabetically | def suit_to_i(suit)
case suit
when /^club/i; 1
when /^diamond/i; 2
when /^heart/i; 3
when /^spade/i; 4
else 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suit_index\n return nil unless self.suit\n SUITS.index(self.suit.downcase)\n end",
"def hand_score(string)\n cards = { A: 4, K: 3, Q: 2, J: 1 }\n score = 0\n string.each_char do |char|\n score += cards[char.upcase.to_sym]\n end\n\n score\nend",
"def array_suit_rank\n h = []; d = [];... | [
"0.651434",
"0.640958",
"0.62112415",
"0.6149823",
"0.6146234",
"0.6098699",
"0.6062754",
"0.60543734",
"0.5996578",
"0.5976758",
"0.588808",
"0.5877834",
"0.5810561",
"0.580654",
"0.58037686",
"0.5788123",
"0.5782864",
"0.5777031",
"0.57533664",
"0.5740672",
"0.5733737",
"... | 0.728741 | 0 |
GET /members GET /members.json | def index
@members = Member.all
@page = Page.find_by_id(8)
@pdf_files = PdfFile.all
@member = Member.new
user = @member.build_user
@roles = Role.find(:all)
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @members }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.85555315",
"0.8368444",
"0.80864495",
"0.79692763",
"0.79227495",
"0.7810278",
"0.7673862",
"0.7492891",
"0.74862355",
"0.7484284",
"0.7484284",
"0.7484284",
"0.7377688",
"0.7360226",
"0.7336541",
"0.7336541",
"0.7235276",
"0.7182636",
"0.718245",
"0.71680915",
"0.71680915... | 0.0 | -1 |
GET /members/1 GET /members/1.json | def show
@member = Member.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_members\n @user = User.find_by(user_params)\n @members = @user.members\n \n if not @members.nil?\n render json: @members\n else \n render json: \"\"\n end\n end",
"def members\n raw_response = get_request('users/members')\n ... | [
"0.8023607",
"0.74336106",
"0.7342003",
"0.7342003",
"0.7342003",
"0.73214304",
"0.7298026",
"0.72192717",
"0.7218691",
"0.7147416",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.7146131",
"0.71341074",
"0.70766354"... | 0.70936525 | 21 |
GET /members/new GET /members/new.json | def new
@member = Member.new
user = @member.build_user
@roles = Role.find(:all)
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @member = Member.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n ... | [
"0.79043746",
"0.78913903",
"0.78913903",
"0.78913903",
"0.78913903",
"0.78913903",
"0.78913903",
"0.78913903",
"0.7789812",
"0.76272595",
"0.75811505",
"0.7546918",
"0.7513603",
"0.7477062",
"0.7446343",
"0.74113417",
"0.7382035",
"0.72367895",
"0.72031033",
"0.71898484",
"0... | 0.7581038 | 11 |
show member application profile | def member_application_received
@member = Member.find(params[:id])
@page = Page.find_by_id(9)
#@products = Product.membership.all
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def show\n @profile = @user.profile\n end",
"def show\n\n\t\t@current_profile = Profile.get_profile params[:id], \"asdf\"\n\n\t\tpretty_render \"api/public_user\"\t\n\n\tend",
"def get_profile_information\n # body = {\n #... | [
"0.72347665",
"0.72001535",
"0.7194275",
"0.71168983",
"0.7070431",
"0.70700645",
"0.70536435",
"0.70536435",
"0.70536435",
"0.70536435",
"0.70536435",
"0.70536435",
"0.7052446",
"0.69768757",
"0.69704676",
"0.69651115",
"0.69578344",
"0.69366294",
"0.6853069",
"0.68274903",
... | 0.0 | -1 |
POST /members POST /members.json | def create
@member = Member.new(params[:member])
@roles = Role.find(:all)
checked_roles = []
checked_params = params[:role_list] || []
for check_box_id in checked_params
role = Role.find(check_box_id)
if not @member.user.roles.include?(role)
@member.user.roles << role
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_member_to_list(user, list, member_id, options={})\n post(\"/#{user}/#{list}/members.json\", options.merge(:id => member_id))\n end",
"def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.ge... | [
"0.6734318",
"0.6707801",
"0.6686722",
"0.66615456",
"0.66511947",
"0.6612481",
"0.6595865",
"0.6571146",
"0.6571146",
"0.6571146",
"0.6569636",
"0.65571123",
"0.65534073",
"0.6552213",
"0.6539384",
"0.6535769",
"0.6534659",
"0.6526704",
"0.6526704",
"0.6526704",
"0.6526704",... | 0.0 | -1 |
PUT /members/1 PUT /members/1.json | def update
@member = Member.find(params[:id])
@roles = Role.find(:all)
if params[:commit] == "Update Member"
checked_roles = []
checked_params = params[:role_list] || []
for check_box_id in checked_params
role = Role.find(check_box_id)
if not @member.user.roles.include?(role)
@member... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n params.require(:member).permit(:name)\n if @member.update(member_params)\n format.html { redirect_to @member, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n ... | [
"0.6593529",
"0.64914197",
"0.64502794",
"0.6438251",
"0.640992",
"0.640992",
"0.640992",
"0.640992",
"0.640992",
"0.6406436",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6386342",
"0.6333237",
"0.6329286",
"0.6... | 0.0 | -1 |
DELETE /members/1 DELETE /members/1.json | def destroy
@member = Member.find(params[:id])
@member.destroy
respond_to do |format|
format.html { redirect_to members_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n\n \n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member.destroy\n\n respond_to do |format|\n format.html { redirect_to me... | [
"0.76810235",
"0.7641482",
"0.7641482",
"0.76110274",
"0.76110274",
"0.7557461",
"0.7545494",
"0.7545494",
"0.7545494",
"0.7545494",
"0.7545494",
"0.7545494",
"0.7545494",
"0.73533356",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",
"0.7306361",... | 0.7567863 | 6 |
GET /system_configs GET /system_configs.json | def index
@system_configs = SystemConfig.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @system_configs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @system_configs = SystemConfig.all\n end",
"def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end",
"def configuration\n _get(\"/system/c... | [
"0.7687127",
"0.7472166",
"0.7378796",
"0.71959513",
"0.71496737",
"0.70668465",
"0.7047415",
"0.7047415",
"0.6990292",
"0.6982907",
"0.687377",
"0.68227947",
"0.6579982",
"0.65095454",
"0.65032756",
"0.6481145",
"0.6463021",
"0.64575064",
"0.6434599",
"0.6399364",
"0.6396348... | 0.7617763 | 1 |
GET /system_configs/new GET /system_configs/new.json | def new
@system_config = SystemConfig.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @system_config }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end",
"def new\n @system_configuration = SystemConfiguration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json... | [
"0.7940224",
"0.7718635",
"0.749071",
"0.7333867",
"0.7051994",
"0.70120174",
"0.69864726",
"0.6907416",
"0.6864903",
"0.6844729",
"0.67083985",
"0.6678077",
"0.6661777",
"0.66283756",
"0.6625292",
"0.66086674",
"0.65783054",
"0.65582246",
"0.65409684",
"0.65363705",
"0.65184... | 0.8056176 | 0 |
POST /system_configs POST /system_configs.json | def create
@system_config = SystemConfig.new(params[:system_config])
respond_to do |format|
if @system_config.save
format.html { redirect_to @system_config, :notice => 'System config was successfully created.' }
format.json { render :json => @system_config, :status => :created, :location ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @system_config = SystemConfig.new(system_config_params)\n\n respond_to do |format|\n if @system_config.save\n format.html { redirect_to @system_config, notice: 'System config was successfully created.' }\n format.json { render action: 'show', status: :created, location: @syste... | [
"0.75000125",
"0.72201836",
"0.7205566",
"0.71132386",
"0.707444",
"0.6874693",
"0.6760946",
"0.6475654",
"0.6391057",
"0.6332941",
"0.625977",
"0.6206812",
"0.61893386",
"0.61772794",
"0.6157509",
"0.6136981",
"0.6124873",
"0.60972494",
"0.60846275",
"0.5971563",
"0.59425056... | 0.7614239 | 0 |
PUT /system_configs/1 PUT /system_configs/1.json | def update
@system_config = SystemConfig.find(params[:id])
respond_to do |format|
if @system_config.update_attributes(params[:system_config])
format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }
format.json { head :ok }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edi... | [
"0.7296367",
"0.708725",
"0.70254064",
"0.6994356",
"0.69509286",
"0.68114644",
"0.6705139",
"0.6618121",
"0.66013545",
"0.65859413",
"0.6581203",
"0.6309043",
"0.6269603",
"0.62648934",
"0.62408966",
"0.61993676",
"0.61475897",
"0.6136858",
"0.61319035",
"0.60844207",
"0.607... | 0.75771815 | 0 |
DELETE /system_configs/1 DELETE /system_configs/1.json | def destroy
@system_config = SystemConfig.find(params[:id])
@system_config.destroy
respond_to do |format|
format.html { redirect_to system_configs_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @system_config.destroy\n respond_to do |format|\n format.html { redirect_to system_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_configuration = SystemConfiguration.find(params[:id])\n @system_configuration.destroy\n\n respond_to ... | [
"0.77710176",
"0.7505579",
"0.7381493",
"0.715496",
"0.7099022",
"0.70592725",
"0.7053916",
"0.6958069",
"0.68906134",
"0.6878146",
"0.684138",
"0.67894405",
"0.6776853",
"0.67591643",
"0.6728555",
"0.6696385",
"0.6682972",
"0.65939933",
"0.6572745",
"0.65579146",
"0.654828",... | 0.7714871 | 1 |
Sets the password reset attributes. | def create_reset_digest
self.reset_digest = SecureRandom.urlsafe_base64.to_s
update_attribute(:reset_digest, reset_digest)
update_attribute(:reset_sent_at, Time.zone.now)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end",
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def attempt_set_password(params)\n p = {}\n ... | [
"0.7047396",
"0.69583577",
"0.6818595",
"0.6749292",
"0.6737656",
"0.670031",
"0.6676551",
"0.66730624",
"0.66577595",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",
"0.66103",... | 0.0 | -1 |
Sends password reset email. | def send_password_reset_email
UserMailer.password_reset(self).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end",
"de... | [
"0.8790497",
"0.86796135",
"0.86796135",
"0.8663904",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86629623",
"0.86587805",
"0.8652506",
"0.8650495",
"0.8648778",
"0.8633209",
"0.8633209",
"0.8633209",
"0.8... | 0.84819937 | 38 |
Request verification for the given email address. If called twice with the same address resends the verification email. | def verify_address(email: )
if email.blank?
raise ArgumentError.new("Missing mandatory value for email parameter.")
end
begin
response = @ses.verify_email_identity(email_address: email)
if response.successful?
Result::Success.new()
else
Result::Erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_email_verification(verification)\n @verification = verification\n mail to: verification.user.email, subject: \"Please verify your email address on docloud.co\"\n end",
"def verify_email!\n self.email_verified_at = Time.now.utc\n self.email_verification_code = nil\n reconcile_privil... | [
"0.7303123",
"0.70363563",
"0.6695378",
"0.66909504",
"0.66547686",
"0.6650338",
"0.63968515",
"0.63778555",
"0.637026",
"0.637026",
"0.6324036",
"0.63233083",
"0.6305906",
"0.62782115",
"0.62782115",
"0.6244857",
"0.6233802",
"0.6201158",
"0.6174137",
"0.6129731",
"0.6114198... | 0.6840486 | 2 |
Test List NOTE: this test failed because algorithm is updated and don't play like the saved game | def test_alg_not_work01
rep = ReplayManager.new(@log)
match_info = YAML::load_file(File.dirname(__FILE__) + '/saved_games/alg_flaw_01.yaml')
rep.replay_match(@core, match_info, {}, segno_num = 1, 1)
assert_equal(0, @io_fake.warn_count)
assert_equal(0, @io_fake.error_count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trivial\n @game.state=[]\n assert_equal [],@game.evolve\n @game.state=[[0]]\n assert_equal [[0]],@game.evolve\n end",
"def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-ga... | [
"0.6438609",
"0.6241442",
"0.61952186",
"0.6155445",
"0.61262006",
"0.60980225",
"0.6079226",
"0.606743",
"0.6061236",
"0.59950167",
"0.5992245",
"0.5962242",
"0.5948187",
"0.5942286",
"0.5936702",
"0.5931408",
"0.5918392",
"0.59116644",
"0.59088224",
"0.5868967",
"0.58640087... | 0.5936798 | 14 |
NOTE: this test failed because algorithm is updated and don't play like the saved game | def test_alg_not_work02
rep = ReplayManager.new(@log)
match_info = YAML::load_file(File.dirname(__FILE__) + '/saved_games/alg_flaw_02.yaml')
segno_num = 0
rep.replay_match(@core, match_info, {}, segno_num, 1)
assert_equal(0, @io_fake.warn_count)
assert_equal(0, @io_fake.error_count)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_alg_not_work01\r\n rep = ReplayManager.new(@log)\r\n match_info = YAML::load_file(File.dirname(__FILE__) + '/saved_games/alg_flaw_01.yaml')\r\n rep.replay_match(@core, match_info, {}, segno_num = 1, 1)\r\n assert_equal(0, @io_fake.warn_count)\r\n assert_equal(0, @io_fake.error_count)\r\n e... | [
"0.69388634",
"0.6864545",
"0.6619914",
"0.6600392",
"0.6554017",
"0.6522781",
"0.6522781",
"0.6522781",
"0.6522781",
"0.6522781",
"0.6521643",
"0.6521643",
"0.65201247",
"0.65176404",
"0.6510825",
"0.6489529",
"0.64781946",
"0.6445393",
"0.63655776",
"0.6279802",
"0.6226432"... | 0.6946957 | 0 |
Public: Used to interact with the Metadata API. | def metadata
@metadata ||= Metaforce::Metadata::Client.new(@options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_metadata; end",
"def read_metadata\n @client.get(metadata_path)\n end",
"def get_metadata(*args)\n self.metadata.get(*args)\n end",
"def metadata\n api_get(\"$metadata\").body\n end",
"def metadata; end",
"def metadata; end",
"def metadata; end",
"def metadata... | [
"0.72888607",
"0.72613883",
"0.7259994",
"0.72573304",
"0.7247551",
"0.7247551",
"0.7247551",
"0.7247551",
"0.7247551",
"0.7247551",
"0.7247551",
"0.6956555",
"0.67510885",
"0.67510885",
"0.67069197",
"0.669359",
"0.6658088",
"0.6658088",
"0.66416353",
"0.66369796",
"0.663490... | 0.729636 | 0 |
Public: Used to interact with the Services API. | def services
@services ||= Metaforce::Services::Client.new(@options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end",
"def services\n\n end",
"def services\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n R... | [
"0.72008306",
"0.71069896",
"0.67756313",
"0.6715266",
"0.6701252",
"0.6689934",
"0.66499627",
"0.6612566",
"0.65518177",
"0.6516342",
"0.64723575",
"0.6464074",
"0.64221555",
"0.6355578",
"0.63526464",
"0.6350692",
"0.6327323",
"0.6307083",
"0.6303697",
"0.62964106",
"0.6281... | 0.64038545 | 13 |
Simple workaround for integration tests. On test environment (host: 127.0.0.1) store current subdomain in the request param :_subdomain. | def default_url_options(options = {})
if cannot_use_subdomain?
{ _subdomain: current_subdomain }
else
{}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_subdomain\n @current_subdomain ||= request.subdomain if request.subdomain\n end",
"def current_subdomain\n @current_subdomain ||= request.subdomain if request.subdomain\n end",
"def set_subdomain\n @subdomain = current_domain\n end",
"def current_website\n subdomain ||= request... | [
"0.79122734",
"0.79122734",
"0.78697807",
"0.7542316",
"0.74788773",
"0.729136",
"0.7289057",
"0.7203199",
"0.71500456",
"0.7049211",
"0.7043183",
"0.69784266",
"0.6955279",
"0.69404346",
"0.68967247",
"0.68872267",
"0.6856378",
"0.6752512",
"0.67406976",
"0.67343205",
"0.666... | 0.0 | -1 |
Returns true when subdomains cannot be used. For example when the application is running in selenium/webkit test mode. | def cannot_use_subdomain?
(Rails.env.test? or Rails.env.development?) and request.host == '127.0.0.1'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_subdomain?(env)\n return true if Storehouse.subdomains.length == 0\n regex = /(^|\\.)(#{Storehouse.subdomains.join('|')})\\./\n !!(env['HTTP_HOST'] =~ regex)\n end",
"def is_a_domain?\n domain? && !subdomain?\n end",
"def is_a_subdomain?\n subdomain?\n end",
"def a... | [
"0.80667657",
"0.772255",
"0.7494051",
"0.7349514",
"0.7335671",
"0.7310857",
"0.72116524",
"0.7202276",
"0.7144121",
"0.7128326",
"0.71133596",
"0.7102206",
"0.70847374",
"0.7048546",
"0.7017786",
"0.7006625",
"0.690877",
"0.69008875",
"0.6887236",
"0.68745935",
"0.6860939",... | 0.82516146 | 0 |
Creates a new election, receiving voter and candidate lists | def create
# Create election from parameters
@election = Election.new(params[:election])
user_id = params[:election][:user_id]
if user_id == ""
flash[:error] = "You may choose owner for election"
redirect_back_or_default(:action => 'new')
return
end
@election.owner = ::User.find(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n args = election_params.slice(:eligible_seats, :title, :description, :election_type, :scope_type, :scope_id_region)\n if election_params[:election_type] != 'resolution'\n args[:preparation_starts_at] = parse_datetime_params(election_params, :preparation_starts_at)\n args[:preparation_en... | [
"0.7448537",
"0.73663706",
"0.698722",
"0.698722",
"0.6916409",
"0.68821335",
"0.6848632",
"0.68103373",
"0.657265",
"0.65617067",
"0.65176165",
"0.6507129",
"0.64171004",
"0.6414615",
"0.6408955",
"0.6347518",
"0.6223335",
"0.62180036",
"0.62142617",
"0.6196076",
"0.61763465... | 0.7380879 | 1 |
Data in cui non la sfida scade | def expiration_date
self.created_at + RunnersBikers::MATCH_DURATION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n wh... | [
"0.5895175",
"0.57977635",
"0.56808776",
"0.56542313",
"0.56477135",
"0.5646406",
"0.5643415",
"0.5623075",
"0.55886596",
"0.5587659",
"0.5543879",
"0.5540517",
"0.5494022",
"0.5474845",
"0.5459235",
"0.5422998",
"0.54075164",
"0.53830683",
"0.53684646",
"0.5363188",
"0.53631... | 0.0 | -1 |
Metodo chiamato singolarmente sul match | def check_timeouts
if self.outdated?
Match.transaction do
self.status = :timeouted
self.set_looser_winner
self.save!
self.update_rank
end
self.email_notify_outdated
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match; end",
"def match; end",
"def match(p0) end",
"def match(p0) end",
"def pre_match() end",
"def post_match() end",
"def match()\n end",
"def match(input); end",
"def match\n true\n end",
"def match\n @match\n end",
"def match(pattern); end",
"def match(keywor... | [
"0.7769909",
"0.7769909",
"0.7682207",
"0.7682207",
"0.7443627",
"0.73889506",
"0.73252",
"0.7113785",
"0.70506924",
"0.70000666",
"0.6949728",
"0.69215554",
"0.68978596",
"0.6801831",
"0.67875993",
"0.67678505",
"0.67678505",
"0.6675072",
"0.6663336",
"0.6605158",
"0.6563796... | 0.0 | -1 |
Rispetto alla situazione del match cambia lo status | def change_status
if wait? and challenged_performance and challenger_performance
self.approval_waiting!
notify_judges
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_match(status, user, match); end",
"def match_cancelled\n Match.find_by(id: self.id).update!(status: \"cancelled\")\n end",
"def update_event_status\n event = wattball_match.event\n\n if event.status != \"played\"\n # If adding scores, then the match can be assumed to have been played\... | [
"0.67289823",
"0.60819775",
"0.59737325",
"0.5935847",
"0.5900301",
"0.58972037",
"0.5891454",
"0.5837631",
"0.57781255",
"0.57692575",
"0.5756604",
"0.57499903",
"0.5719139",
"0.5694963",
"0.5657901",
"0.56351",
"0.56182355",
"0.56126696",
"0.56087226",
"0.5592448",
"0.55848... | 0.0 | -1 |
Get the API path for this class. | def aggregate_uri_path(className)
self.class.aggregate_uri_path(className)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_path\n @api_path ||= find_api_path(base_uri)\n end",
"def api_url(path)\n path\n end",
"def path\n # if an api_version is specified and the path does not already contain\n # one, prepend it to the path\n api_version = raw_options[:api_version] || Blupee.config.a... | [
"0.7928207",
"0.73897135",
"0.73264647",
"0.7217297",
"0.7167958",
"0.7167496",
"0.7018199",
"0.6941744",
"0.68935424",
"0.68866104",
"0.6868016",
"0.6810441",
"0.6653764",
"0.6653228",
"0.6608531",
"0.6592796",
"0.657643",
"0.656932",
"0.6565546",
"0.6538358",
"0.6521651",
... | 0.0 | -1 |
def list_params params.require(:list).permit(:user_id, :movie) end Before filters Confirms a loggedin user. | def logged_in_user
unless logged_in?
store_location
flash[:danger] = 'Please log in.'
redirect_to login_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movielist_params\n params.require(:movielist).permit(:movie_id, :list_id)\n end",
"def list_params\n params.require(:list).permit(:title, :content, :user_id) #user_idを受け取れるようにする\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def lis... | [
"0.7907565",
"0.7862261",
"0.77424234",
"0.77227306",
"0.759074",
"0.75458294",
"0.74989855",
"0.74117726",
"0.73883736",
"0.7297299",
"0.7280952",
"0.6978902",
"0.69624627",
"0.6956646",
"0.6911956",
"0.68679535",
"0.685974",
"0.6833772",
"0.68321615",
"0.68206483",
"0.68206... | 0.0 | -1 |
Confirms the list record belongs to the current user. | def correct_list
user = current_user
list = user.lists.find_by(movie: params[:movie])
redirect_to(root_url) if list.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user\n list = current_user.lists.find_by(params[:list_id]) \n card = list.cards.find_by(id: params[:card_id])\n redirect_to root_url if card.nil?\n end",
"def set_current_list_id!\n redirect_to user_lists_path(current_user), :alert => \"Current list not set\" unless curren... | [
"0.62763625",
"0.62682915",
"0.6181095",
"0.61256456",
"0.6112956",
"0.60717195",
"0.604927",
"0.604927",
"0.60374856",
"0.6028551",
"0.59586823",
"0.5956791",
"0.593188",
"0.59171003",
"0.58671606",
"0.58521295",
"0.5848048",
"0.58273876",
"0.5823406",
"0.5804351",
"0.579343... | 0.5700965 | 31 |
Replace with real successful acknowledgement code | def test_acknowledgement
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_status_response( txn, status_code, message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\ttxn.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it.\n\t\tunless BODILESS_HTTP_RESPONSE_CODES.include?( status_code )\n\t\... | [
"0.6586824",
"0.65589076",
"0.64850795",
"0.64850795",
"0.6473702",
"0.6424179",
"0.6379759",
"0.6358759",
"0.6347187",
"0.63096136",
"0.62933904",
"0.6200912",
"0.61907935",
"0.61759096",
"0.61759096",
"0.61759096",
"0.61759096",
"0.61759096",
"0.61759096",
"0.6174765",
"0.6... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: split the input string into words add each word to the hash with a default value of 1 print the list to the console [can you use one of your other methods here?] output: hash | def make_list(item_list)
item_list = item_list.split(' ')
list = {}
item_list.each do | item |
list[item] = 1
end
print_list(list)
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_list (string)\nitem_hash= hash.new\nitem_array = string.split\nitem_array.each do |item|\n item_hash[item] = 1\nend\nitem_hash\nend",
"def create_list(string)\n list = {}\n string = string.split \n\n string.each { |item| \n list[item] = 1\n }\n\n printhash(list)\n\n list\nend",
"def string_t... | [
"0.7349514",
"0.7269602",
"0.7262312",
"0.72595",
"0.7239761",
"0.7215319",
"0.72015435",
"0.71625954",
"0.71609277",
"0.7133472",
"0.7122309",
"0.70731896",
"0.70615554",
"0.70008755",
"0.6991214",
"0.6967604",
"0.69637054",
"0.69637054",
"0.69206536",
"0.6908556",
"0.688459... | 0.6654985 | 51 |
Method to add or update an item to a list input: list, item name, and optional quantity steps: add item to the list (hash) if quantity is given, set it as quantity otherwise, set quantity as 1 output: list | def update_list(list, item_name, quantity=1)
list[item_name] = quantity
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def add_or_update_item(list, item, quantity=1)\n\tlist[item] = quantity\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\... | [
"0.8299711",
"0.8292311",
"0.8262398",
"0.8261498",
"0.82290703",
"0.8228351",
"0.8228351",
"0.82172596",
"0.82142234",
"0.81866884",
"0.81812996",
"0.8168594",
"0.8167381",
"0.81575495",
"0.81286055",
"0.80981976",
"0.80981976",
"0.80875415",
"0.80872506",
"0.8086723",
"0.80... | 0.807292 | 23 |
Method to remove an item from the list input: list, item name steps: find the item in the hash by key delete that key/value pair output: list | def remove_item(list, item_name)
list.delete(item_name)
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item na... | [
"0.8649028",
"0.8555257",
"0.8449224",
"0.83753973",
"0.8371625",
"0.8358447",
"0.8335196",
"0.8190993",
"0.81679136",
"0.81399953",
"0.8123315",
"0.80996424",
"0.80791277",
"0.8047935",
"0.80147606",
"0.8001189",
"0.800114",
"0.80003965",
"0.79947686",
"0.7973664",
"0.79303"... | 0.7686068 | 42 |
Method to update the quantity of an item input: list, item name, quantity steps: find the item in the hash update the value of that key to quantity output: list def update_item(list, item_name, quantity) if !list.include? item_name puts "Please use 'add_item' method." else list[item_name] = quantity end list end Method... | def print_list(list)
puts "GROCERY LIST"
list.each do | item, quantity |
puts "#{item.capitalize}: #{quantity}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend",
"def update_item_quantity(list_hash,item_name,qu... | [
"0.8820051",
"0.8444833",
"0.844041",
"0.83882135",
"0.8384024",
"0.8359328",
"0.8352644",
"0.8322099",
"0.8266024",
"0.82573533",
"0.82473576",
"0.82269186",
"0.8211526",
"0.82047796",
"0.8201749",
"0.81828266",
"0.81828266",
"0.8173023",
"0.8164733",
"0.8164733",
"0.8159568... | 0.0 | -1 |
Accounting.config do |a| a.credit_report = "CreditReport" end | def config
yield self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_accounting_report\n @accounting_report = AccountingReport.find(params[:id])\n end",
"def set_report\n end",
"def set_accounting_statement\n @accounting_statement = AccountingStatement.find(params[:id])\n end",
"def set_accounting\n @accounting = Accounting.find(params[:id])\n ... | [
"0.65069145",
"0.6312598",
"0.62417734",
"0.60796577",
"0.5967802",
"0.5951134",
"0.59420663",
"0.5835809",
"0.5722516",
"0.5700013",
"0.5663137",
"0.5659959",
"0.56540585",
"0.56430125",
"0.56421596",
"0.56263995",
"0.56054604",
"0.5605089",
"0.56027687",
"0.55952954",
"0.55... | 0.0 | -1 |
value to the value next to it and swaps values accordingly until it reaches the end of the array. it repeats and continues the process while shortening the array by one after every iteration. once it compares each value against the other values in the array, the expected result is a sorted array. | def bubble_sort(arr)
temp_arr = []
arr.each{|x| temp_arr << x }
until temp_arr.length == 1 do
temp_arr.each_with_index do |x, index|
if index == temp_arr.length-1
else
curr_x = arr[index]
next_x = arr[index+1]
if curr_x > next_x
#swap numbers
temp = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bubbly(arr)\n loop do\n switch = false\n (arr.length - 1).times do |i|\n \tif arr[i] > arr[i + 1]\n arr[i + 1],arr[i] = arr[i],arr[i + 1]\n switch = true\n end\n end\n if switch == false\n break\n end\n end\n arr\nend",
"def bubble_sort_by(array)\n swap_status = ... | [
"0.73177713",
"0.7275843",
"0.722782",
"0.7209722",
"0.719718",
"0.71918356",
"0.71723753",
"0.7151423",
"0.7140462",
"0.71251917",
"0.7102126",
"0.70694375",
"0.70694375",
"0.7068868",
"0.7053443",
"0.7036637",
"0.7029975",
"0.7028173",
"0.7026916",
"0.70260423",
"0.701491",... | 0.0 | -1 |
GET /levels GET /levels.json | def index
@levels = Level.where(:game_id => params[:game_id])
@game = Game.find(params[:game_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @founda... | [
"0.8801227",
"0.8087689",
"0.76308846",
"0.7383071",
"0.73609537",
"0.7335523",
"0.73326796",
"0.73063225",
"0.73063225",
"0.7286317",
"0.71846485",
"0.71316",
"0.7014164",
"0.6664373",
"0.65639746",
"0.65568966",
"0.65081346",
"0.65032876",
"0.6474081",
"0.64335424",
"0.6421... | 0.6400107 | 22 |
GET /levels/1 GET /levels/1.json | def show
@level = Level.find(params[:id])
@first = Level.where(:game_id => @level.game_id).first
@last = Level.where(:game_id => @level.game_id).last
case
when @level.id == @first.id
@next_index = @level.level_index.to_i + 1
@prev_index = @level.level_index.to_i
when @lev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @founda... | [
"0.8155953",
"0.7941919",
"0.7298746",
"0.72238857",
"0.72238857",
"0.71191037",
"0.7088853",
"0.7037682",
"0.684296",
"0.6802548",
"0.6785393",
"0.67550886",
"0.67504156",
"0.6700359",
"0.6670731",
"0.6586478",
"0.6576319",
"0.65693545",
"0.65515155",
"0.65410626",
"0.651443... | 0.0 | -1 |
POST /levels POST /levels.json | def create
if admin?
@level = Level.new(level_params)
respond_to do |format|
if @level.save
format.html { redirect_to @level, notice: 'Level was successfully created.' }
format.json { render :show, status: :created, location: @level }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @level = Level.new(params[:level])\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: 'Level was successfully created.' }\n format.json { render json: @level, status: :created, location: @level }\n else\n format.html { render ac... | [
"0.6971333",
"0.6971333",
"0.66188776",
"0.6605027",
"0.6528696",
"0.6475621",
"0.64615446",
"0.64384544",
"0.6362735",
"0.63355964",
"0.6253227",
"0.6235083",
"0.6231185",
"0.6224483",
"0.61914253",
"0.6158239",
"0.6133909",
"0.612062",
"0.6107473",
"0.6105576",
"0.6102901",... | 0.6745412 | 2 |
PATCH/PUT /levels/1 PATCH/PUT /levels/1.json | def update
if admin?
respond_to do |format|
if @level.update(level_params)
format.html { redirect_to @level, notice: 'Level was successfully updated.' }
format.json { render :show, status: :ok, location: @level }
else
format.html { render :edit }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @level = Level.find(params[:id])\n\n respond_to do |format|\n if @level.update_attributes(params[:level])\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.7265425",
"0.7264228",
"0.709664",
"0.7021026",
"0.6736875",
"0.67058194",
"0.6573044",
"0.65600836",
"0.65579283",
"0.6532633",
"0.653088",
"0.6437216",
"0.6437216",
"0.6431953",
"0.640332",
"0.6399678",
"0.6346146",
"0.6298112",
"0.62967587",
"0.6286596",
"0.6262382",
... | 0.6876877 | 4 |
DELETE /levels/1 DELETE /levels/1.json | def destroy
if admin?
@level.destroy
respond_to do |format|
format.html { redirect_to levels_url, notice: 'Level was successfully destroyed.' }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @level = Level.find(params[:id])\n @level.destroy\n\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level = Level.find(params[:id])\n @level.destroy\n\n respond_to do |format|\n f... | [
"0.7857027",
"0.78528327",
"0.77925295",
"0.7465844",
"0.7338106",
"0.72167164",
"0.7184339",
"0.7118995",
"0.7118995",
"0.70924056",
"0.7016046",
"0.7006704",
"0.7005752",
"0.6864805",
"0.68348837",
"0.68338835",
"0.6790614",
"0.6739585",
"0.66947246",
"0.6627863",
"0.661820... | 0.7302804 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.