Skip to content

Instantly share code, notes, and snippets.

View AhmedKamal20's full-sized avatar
🐧
Linuxing

Ahmed Kamal AhmedKamal20

🐧
Linuxing
View GitHub Profile
@afa
afa / gist:1451070
Created December 9, 2011 10:48
cucmber cheatsheet
#Navigating
visit('/projects')
visit(post_comments_path(post))
#Clicking links and buttons
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@akhal3d96
akhal3d96 / start_vpn.sh
Last active August 22, 2016 13:05
Quickly establish a connection with a free VPN server in USA in order to access Spotify's services
curl -o vpn.zip -s "https://www.vpnbook.com/free-openvpn-account/VPNBook.com-OpenVPN-US1.zip" && unzip vpn.zip -d ~/vpn_files && echo "vpnbook" > ~/.auth && curl -s "https://www.vpnbook.com/" | grep Password | tr -d '\t\n\r\f' | grep -Eo 'Password: [a-zA-Z0-9]*' | uniq | sed 's/Password: //' >> ~/.auth && sudo openvpn --config ~/vpn_files/vpnbook-us1-tcp443.ovpn --auth-user-pass ~/.auth
@elisemoe
elisemoe / notes.md
Last active July 17, 2021 00:27
Cucumber Step Definition - Useful Code and Comments

//scroll to the bottom of the page

((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");

Note: Do not upgrade Firefox browser version later than 40 - not compatible with latest Selenium Firefox Driver

Regex for a booking number: ^Ocean #BK+[0-9]{8}


@jonlabelle
jonlabelle / strip_tag_attribs.md
Last active October 30, 2022 15:08
This Regular Expression removes all attributes and values from an HTML tag, preserving the tag itself and textual content (if found).

Strip HTML Attributes

<([a-z][a-z0-9]*)[^>]*?(/?)>
token explanation
< match < at beginning of tags
( start capture group $1 - tag name
[a-z] match a through z

Features and Step Definitions

Gherkin Keywords

  • Feature
  • Background
  • Scenario
  • Given
  • When
  • Then
  • And
@jraines
jraines / rails31init.md
Created May 24, 2011 17:03
Rails 3.1 with Rspec, Cucumber, Factory Girl, Haml, and Simple Form

Install Rails 3.1 RC

gem install rails --pre

generate new app, skipping Test::Unit file generation

rails new my_app -T

Set up Gemfile

@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@sk22
sk22 / lastfm-remove-duplicates.js
Last active January 13, 2024 16:26
Last.fm duplicate scrobble deleter
var elements = Array.from(document.querySelectorAll('.js-link-block'))
elements.map(function (element) {
var nameElement = element.querySelector('.chartlist-name')
return nameElement && nameElement.textContent.replace(/\s+/g, ' ').trim()
}).forEach(function (name, i, names) {
if (name !== names[i + 1]) return
var deleteButton = elements[i].querySelector('[data-ajax-form-sets-state="deleted"]')
if (deleteButton) deleteButton.click()
location.reload()
})
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...
####
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet