Skip to content

Instantly share code, notes, and snippets.

@MurtzaM
MurtzaM / Img Alt Tag Scraper using Nokogiri
Last active March 11, 2022 11:26
Scrapes img alt tags from HTML using Ruby with Nokogiri gem
require 'nokogiri'
require 'open-uri'
#Scrapes img alt tags from specified URL
url = "CHANGE ME"
alt_tags = Array.new
doc = Nokogiri::HTML(open(url))
alt_tags = doc.css('img').map{ |i| i['alt'] }
#Prints out unique alt tags

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@MurtzaM
MurtzaM / deleteMarketoTrackingCookie.js
Last active August 29, 2015 14:06
This script deletes Marketo tracking cookie after Marketo form submission
// This script deletes Marketo tracking cookie after Marketo form submission
// When a form is submitted by a user, the deleteMarketoCookie function is called
// Created by Murtza Manzur on 08/22/14
//Load Marketo forms script.
<script src="//app-sjqe.marketo.com/js/forms2/js/forms2.js"></script>
<script>
function delete_cookie (name, path, domain) {
document.cookie = name + "=" +
@MurtzaM
MurtzaM / preventNonBusinessEmailSubmission.js
Created September 9, 2014 23:49
This script will prevent Marketo form submission if a user enters a non-business email (Gmail, Hotmail, etc.)
//This script prevents Marketo form submission if a user enters non-business email (Gmail, Hotmail, Yahoo, etc.)
//It will work on any page with a Marketo form, and runs when the form is ready
//For further info, please see Marketo form documentation, http://developers.marketo.com/documentation/websites/forms-2-0/
//Prepared by Ian Taylor and Murtza Manzur on 9/9/2014
<script>
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
@MurtzaM
MurtzaM / Find-Nearest-Marketo-Office.html
Last active August 22, 2016 09:12
Dynamically Change Page Content Based on a User’s Location
<!--
This example takes a user's location, and returns the nearest Marketo office location and its phone number. If a user's location is not accessible, the script defaults to Marketo's global office location and phone number.
Created by Murtza Manzur on 01/07/2015
-->
<html>
<head>
<!-- This example uses the Geolib JavaScript library, https://github.com/manuelbieh/Geolib. Replace reference below to where you host this library.-->
<script src="http://developers.marketo.com/blog/wp-content/uploads/2015/01/geolib.js"></script>
</head>