Skip to content

Instantly share code, notes, and snippets.

@bayyar
bayyar / Linkedin Profile Finder
Last active August 29, 2015 14:10
Takes in a CSV of company names, and outputs a CSV with 40 relevant LinkedIn profile URLs (based on params defined in Google CSE) per company
require 'google_custom_search_api'
require 'json'
require 'csv'
# Enter's API key and Custom Search Engine identifier
GOOGLE_API_KEY = 'ENTER_GOOGLE_API_KEY'
GOOGLE_SEARCH_CX = 'ENTER_CSE_IDENTIFIER'
read_file = 'LOCATION_OF_CSV_WITH_COMPANY_NAMES'
write_file = 'LOCATION_OF_OUTPUT_CSV'
@bayyar
bayyar / csv_row_count
Last active August 29, 2015 14:09
Counts the number of rows in several CSVs located in one directory, and outputs the result into a single CSV
require 'csv'
# Set the output file
write_file = '/../summary.csv'
Dir.foreach("/Users/../") do |file|
next if file == '.' or file == '..'
rows = File.foreach("/Users/../#{file}").count
puts "#{file} has #{rows} rows"