This file contains 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
module HTMLValidator | |
def filled_field_is_valid(selector) | |
page.evaluate_script "document.querySelector('#{selector}').validity.valid" | |
end | |
def filled_field_validity(selector) | |
page.evaluate_script "document.querySelector('#{selector}').validity" | |
end | |
end | |
|
This file contains 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
// usage wp-permission-fix <wp dir> | |
wp-permissions-fix(){ | |
sudo chown -R ubuntu:www-data $1 | |
sudo find $1 -type d -exec chmod 755 {} \; | |
sudo find $1 -type f -exec chmod 644 {} \; | |
sudo find $1/wp-content/uploads/ -type d -exec chmod 775 {} \; | |
} |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>teste</title> | |
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script> | |
</head> | |
<body> | |
<script> | |
function newDOM(tag){ |
This file contains 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
State.find_or_create_by(id: 1, name: 'Acre', acronym: 'AC', latitude: -9.11, longitude: -70.52, zoom: 6) | |
State.find_or_create_by(id: 2, name: 'Alagoas', acronym: 'AL', latitude: -9.57, longitude: -36.55, zoom: 6) | |
State.find_or_create_by(id: 3, name: 'Amapá', acronym: 'AP', latitude: 1, longitude: -52, zoom: 6) | |
State.find_or_create_by(id: 4, name: 'Amazonas', acronym: 'AM', latitude: -5, longitude: -63, zoom: 6) | |
State.find_or_create_by(id: 5, name: 'Bahia', acronym: 'BA', latitude: -12.52, longitude: -41.69, zoom: 6) | |
State.find_or_create_by(id: 6, name: 'Ceará', acronym: 'CE', latitude: -5.08, longitude: -39.65, zoom: 6) | |
State.find_or_create_by(id: 7, name: 'Distrito Federal', acronym: 'DF', latitude: -15.795, longitude: -47.757778, zoom: 6) | |
State.find_or_create_by(id: 8, name: 'Espírito Santo', acronym: 'ES', latitude: -20.318889, longitude: -40.337778, zoom: 6) | |
State.find_or_create_by(id: 9, name: 'Goiás', acronym: 'GO', latitude: -15.933333, longitude: -50.133333, zoom: 6) | |
State.find_or_create_by(id: 10, na |
This file contains 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
Array.prototype.recMap = function(callback){ | |
var cicle = function(current, collection, fnModifier) { | |
console.log(current, collection, fnModifier) | |
if(current < collection.length){ | |
collection[current] = fnModifier(collection[current]); | |
return cicle(current + 1, collection, fnModifier); | |
}else{ | |
return collection; |
This file contains 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 Connector from './connector'; | |
export default class Api{ | |
constructor(){ | |
this.connector = new Connector(); | |
} | |
all(onSuccess,onError){ | |
this.connector.get(`${this.url}`) | |
.success(onSuccess).fail(onError); |
This file contains 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
#usage: $ create_dsn 'username' 'password' 'host' | |
create_dsn(){ | |
USER_NAME=$1 | |
PASSWORD=$2 | |
HOST=$3 | |
echo "CREATE DATABASE $USER_NAME;" >> "$USER_NAME.dsn" | |
echo "CREATE ROLE $USER_NAME LOGIN PASSWORD '$PASSWORD';" >> "$USER_NAME.dsn" | |
echo "ALTER DATABASE $USER_NAME OWNER TO $USER_NAME;" >> "$USER_NAME.dsn" |
This file contains 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 Promise from 'promise-polyfill'; | |
import fetchPonyfill from 'fetch-ponyfill'; | |
if (!window.Promise) { | |
window.Promise = Promise; | |
} | |
const {fetch, Request, Response, Headers} = fetchPonyfill(); | |
export default class Download { | |
constructor(url, name){ |
This file contains 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
#!/bin/bash | |
sudo vde_switch -d -sock /tmp/sw1 -M /tmp/sw1.mgmt | |
sudo slirpvde -d -s /tmp/sw1 -q | |
vm-file(){ | |
sudo qemu-system-x86_64 -enable-kvm -m 3150 -vga std -soundhw hda \ | |
-cpu host -smp 4,sockets=1,cores=2,threads=2 \ |