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
class Array | |
def my_map | |
new_arr = [] | |
for el in self | |
new_arr.push(yield(el)) | |
end | |
new_arr | |
end | |
def my_map! |
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
DEFAULT_TIMES_TO_RUN = 1 | |
def build_msg(types_data:{words: [], numbers: []}) | |
msg = "these are the words: #{types_data[:words]}, these are the numbers: #{types_data[:numbers]}" | |
if types_data[:other] and types_data[:other].class.eql(Array) and types_data[:other].length > 0 | |
msg += ", these are the other elements: #{types_data[:other]}" | |
end | |
msg | |
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
import argparse, httplib2, os, re, requests, sys, time; | |
from datetime import datetime | |
from tqdm import tqdm | |
parser = argparse.ArgumentParser() | |
parser.add_argument("-s", "--season", help="numeric season", type=int) | |
parser.add_argument("-p", "--path", help="download path") | |
args = parser.parse_args() |
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 time; | |
import os; | |
import sys; | |
from selenium import webdriver; | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile; | |
import glob; | |
# import pdb; ## debugger | |
def get_filename(folder_before, folder_after): | |
change = set(folder_after) - set(folder_before) |
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 time; | |
import os; | |
import sys; | |
from selenium import webdriver; | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile; | |
if len(sys.argv) > 1: | |
download_path = os.path.expanduser(sys.argv[1]); | |
else: | |
download_path = os.path.expanduser('~/Desktop'); |
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 time; | |
from selenium import webdriver; | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile; | |
profile = FirefoxProfile(); | |
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", 'text/csv'); | |
driver = webdriver.Firefox(firefox_profile=profile); | |
driver.get("https://www.fangraphs.com/projections.aspx?pos=all&stats=bat&type=steamer&team=0&lg=all&players=0"); | |
driver.find_element_by_link_text('Export Data').click(); |
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
require 'combine_pdf' | |
require 'libreconv' | |
require 'optparse' | |
soffice_path = "/Applications/LibreOffice.app/Contents/MacOS/soffice" | |
args = {} | |
OptionParser.new do | arg | |
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
require 'combine_pdf' | |
require 'libreconv' | |
soffice_path = "/Applications/LibreOffice.app/Contents/MacOS/soffice" | |
## Default files taken from current working directory | |
file_path = ARGV[ 0 ] || Dir.pwd | |
## Default, files saved to desktop | |
save_path = ARGV[ 1 ] || ENV['HOME'] + '/Desktop/' |
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
require 'combine_pdf' | |
## Default files taken from current working directory | |
file_path = ARGV[ 0 ] || Dir.pwd | |
## Default, files saved to desktop | |
save_path = ARGV[ 1 ] || ENV['HOME'] + '/Desktop/' | |
file_path = File.join( file_path , "") | |
save_path = File.join( save_path , "") |
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/sh | |
if [ ! -f "`which brew`" ] ; then | |
echo "installing homebrew" | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
else | |
brew update | |
fi | |
if brew ls --versions imagemagick > /dev/null; then |
NewerOlder