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
<?php | |
// Enrico Simonetti | |
// enricosimonetti.com | |
// custom/logichooks/application/afterEntryPoint.php | |
class afterEntryPoint | |
{ | |
public function disableActivityStream($event, $arguments) |
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
<?php | |
// Enrico Simonetti | |
// enricosimonetti.com | |
// | |
// 2017-11-01 on Sugar 7.9.2.0 | |
function usage($error = '') { | |
if (!empty($error)) print(PHP_EOL . 'Error: ' . $error . PHP_EOL); | |
print(' php ' . __FILE__ . ' --instance /full/path' . PHP_EOL); |
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
<?php | |
// Enrico Simonetti | |
// enricosimonetti.com | |
// | |
// 2017-11-01 tested on Sugar 7.9.1.0 | |
// Forcing custom Sugar Cache to autoload: https://gist.github.com/esimonetti/78999f4dfbac22fd26bab8453a0ed149 | |
// | |
// file: custom/Extension/application/Ext/Include/autoload_custom_redis_cache.php | |
SugarAutoloader::addDirectory('custom/include/SugarCache/'); |
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
<?php | |
// Enrico Simonetti | |
// enricosimonetti.com | |
// | |
// Original work: https://gist.github.com/lblockken/78a59273f2460b36eb127a7c2ee510a1 | |
// | |
// 2017-07-31 on Sugar 7.9.1.0 with PHP 7.1 | |
// filename: custom/include/SugarXHprof/TidewaysProf.php |
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
from lxml import html | |
import requests | |
# 1. Scrape list of medical conditions | |
page = requests.get('https://www.nhsinform.scot/illnesses-and-conditions/a-to-z') | |
tree = html.fromstring(page.content) | |
# Scrape from this content and strip off spaces, tabs, and line breaks | |
# <h2 class="module__title"> | |
# Abdominal aortic aneurysm |
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
from lxml import html | |
from lxml.html.clean import Cleaner | |
import requests | |
def remove_duplicates(mylist): | |
return list(dict.fromkeys(mylist)) | |
cleaner = Cleaner() |