This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let chai = require('chai').use(require('chai-as-promised')); | |
let expect = chai.expect; | |
import { binding, given, when, then } from 'cucumber-tsflow'; | |
import { CallbackStepDefinition } from 'cucumber'; | |
import { LoginPageObject } from './login.page'; | |
@binding() | |
class LoginSteps { | |
private loginPageObject = new LoginPageObject(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { element, by, protractor, ElementArrayFinder } from 'protractor'; | |
import { promise as wdpromise } from 'selenium-webdriver'; | |
export class LoginPageObject { | |
private form; | |
private passwordInput; | |
private emailInput; | |
private submitButton; | |
private title; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Login | |
Scenario Outline: The user is using the login form | |
Given user clicks the login link | |
Given '<email>' is the user email in the login form | |
Given '<password>' is the user password in the login form | |
When submitting the login form | |
Then the login form is validated '<valid>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
beforeSend: function (qXHR, settings) { | |
$('#loading').fadeIn(); | |
}, | |
complete: function () { | |
$('#loading').fadeOut(); | |
}, | |
type : "post", | |
url : wp_ajax_tets_vars.ajax_url, | |
data : { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hook para usuarios no logueados | |
add_action('wp_ajax_nopriv_notify_button_click', 'notify_button_click'); | |
// Hook para usuarios logueados | |
add_action('wp_ajax_notify_button_click', 'notify_button_click'); | |
// Función que procesa la llamada AJAX | |
function notify_button_click(){ | |
// Check parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' ); | |
function ajax_test_enqueue_scripts() { | |
wp_enqueue_script( 'test', plugins_url( ‘/ajax-test.js', __FILE__ ), array('jquery'), '1.0', true ); | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready( function(){ | |
$(‘#my-button’).on('click', function(){ | |
//La llamada AJAX | |
$.ajax({ | |
type : "post", | |
url : 'your-admin-ajax.php', // Pon aquí tu URL | |
data : { | |
action: "notify_button_click", | |
message : "Button has been clicked!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while i<CHARACTERS_LEN*CHARACTERS_LEN: | |
generated_name = next(generated_name) | |
username = ''.join(generated_name) | |
url = 'http://twitter.com/jairo'+username | |
r = requests.get(url) | |
if r.status_code == 404: | |
print('AVAILABLE USERNAME:\t jairo'+ username) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import requests | |
CHARACTERS = string.ascii_lowercase+'_' | |
CHARACTERS_LEN = len(CHARACTERS) | |
def indexToCharacter(index): | |
if CHARACTERS_LEN <= index: | |
raise ValueError("Index out of range.") | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def next(string): | |
if len(string) <= 0: | |
string.append(indexToCharacter(0)) | |
else: | |
string[0] = indexToCharacter((characterToIndex(string[0]) + 1) % CHARACTERS_LEN) | |
if CHARACTERS.index(string[0]) is 0: | |
return list(string[0]) + next(string[1:]) | |
return string |