Skip to content

Instantly share code, notes, and snippets.

View lflucasferreira's full-sized avatar
🎈
Don't you want it?

Lucas Ferreira lflucasferreira

🎈
Don't you want it?
View GitHub Profile
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@JunichiIto
JunichiIto / alias_matchers.md
Last active June 24, 2024 21:02
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@sdnts
sdnts / example.md
Last active January 10, 2023 20:50
Postman pm.sendRequest example

To send a request via the sandbox, you can use pm.sendRequest.

pm.test("Status code is 200", function () {
    pm.sendRequest('https://postman-echo.com/get', function (err, res) {
        pm.expect(err).to.not.be.ok;
        pm.expect(res).to.have.property('code', 200);
        pm.expect(res).to.have.property('status', 'OK');
    });
});
@bcnzer
bcnzer / postman-pre-request.js
Last active June 4, 2024 08:55
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@tamasgal
tamasgal / ParallelDockerJenkinsfile
Last active December 26, 2023 12:41
Looping through a list of docker images and execute their stages in parallel. More info here: https://stackoverflow.com/questions/49782267/running-multiple-docker-containers-from-a-single-jenkinsfile
def docker_images = ["python:2.7.14", "python:3.5.4", "python:3.6.2"]
def get_stages(docker_image) {
stages = {
docker.image(docker_image).inside {
stage("${docker_image}") {
echo 'Running in ${docker_image}'
}
stage("Stage A") {
switch (docker_image) {
@dinvlad
dinvlad / pre_request.js
Last active April 11, 2024 02:57
Auto-generate Google Access and ID tokens from a Service Account key and save it in Postman
/* This script auto-generates a Google OAuth token from a Service Account key,
* and stores that token in accessToken variable in Postman.
*
* Prior to invoking it, please paste the contents of the key JSON
* into serviceAccountKey variable in a Postman environment.
*
* Then, paste the script into the "Pre-request Script" section
* of a Postman request or collection.
*
* The script will cache and reuse the token until it's within
@dennismclaugh
dennismclaugh / dockerfile
Last active January 17, 2020 22:25
Dockerfile based on Alpine Linux complete with Ruby, Watir Webdriver, Shopify API, Chrome, and Firefox. https://www.dennismclaughlin.tech/build-docker-image-ruby-watir-webdriver-shopify-and-chrome/
FROM alpine:latest
# Point to specific Alpine Package repositories for Chromium and Firefox.
RUN apk update && apk upgrade \
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/community >> /etc/apk/repositories \
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/main >> /etc/apk/repositories \
&& echo @edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \
&& echo @edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
# Install Ruby dev environment