Skip to content

Instantly share code, notes, and snippets.

function synchronize() {
 messages = []
 function_counter = 0
 $.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   beforeSend: function() {
     function_counter ++
   },
function getData() {
 function_counter = 0
 $.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   beforeSend: function() {
     function_counter ++
   },
   complete: function() {
function getData() {
 function_counter = 0
 $.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   beforeSend: function() {
     function_counter ++
   },
   complete: function() {
function getData() {
 function_counter = 0
 $.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   beforeSend: function() {
     function_counter ++
   }
 })
function getData() {
 function_counter = 0
 $.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path()
 })
}  
function getData() {
 function_counter = 0
}
$.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   success: function() {
     $.ajax({
        dataType: 'json',
        type: 'POST',
        url: Routes.call_to_api2_path(),
        success: function() {
$.ajax({
   dataType: 'json',
   type: 'POST',
   url: Routes.call_to_api1_path(),
   success: function() {
       redirect()
   }
})
$(document).on('submit', '#login-form', function(e) {
 e.preventDefault()
 form = $('#login-form').serialize()
 $.ajax({
   data: form,
   dataType: 'json',
   type: 'POST',
   url: Routes.sessions_path(),
   success: function() {
     getData()
class MyClass
def initialize(**args)
args.each do |k, v|
instance_variable_set("@#{k}", v)
define_singleton_method(k) do
instance_variable_get(:"@#{k}")
end
define_singleton_method("#{k}=") do |v|
instance_variable_set("@#{k}", v)
end