Skip to content

Instantly share code, notes, and snippets.

View jorgecoa's full-sized avatar

Jorge jorgecoa

View GitHub Profile
@itdaniher
itdaniher / common_and_latin_name.json
Last active March 29, 2023 20:50
common_and_latin_name.json
{
"7 Pot Brain Strain Red Pepper": "Capsicum chinense",
"7 Pot Bubble Gum Pepper": "Capsicum chinense",
"7 Pot Pepper Barrackpore": "Capsicum chinense",
"7 Pot Pepper Brain Strain Yellow": "Capsicum chinense",
"7 Pot Pepper Orange": "Capsicum chinense",
"7 Pot Pepper Yellow": "Capsicum chinense",
"7 Pot Pink Pepper": "Capsicum chinense",
"7 Pot Rust Pepper": "Capsicum chinense",
"Abe Lincoln Tomato": "Solanum lycopersicum",
@Daniel-Hug
Daniel-Hug / collision-detection.js
Last active October 9, 2024 13:10
JS functions: check if 2 rectangles intersect, are touching, or if one contains the other
// Check if rectangle a contains rectangle b
// Each object (a and b) should have 2 properties to represent the
// top-left corner (x1, y1) and 2 for the bottom-right corner (x2, y2).
function contains(a, b) {
return !(
b.x1 < a.x1 ||
b.y1 < a.y1 ||
b.x2 > a.x2 ||
b.y2 > a.y2
);
@ziadoz
ziadoz / install.sh
Last active October 4, 2025 06:28
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@DamianEdwards
DamianEdwards / json-in-markdown.md
Last active September 29, 2025 14:24
JSON comments on GH

What happens if you tell GitHub it's JSON

{
  "hello": "world" // I want my comments!
}

Use jsonc as the language instead

{
@yurydelendik
yurydelendik / gist:f2b846dae7cb29c86d23
Last active August 1, 2025 10:57
PDF.js get/show hightlight
function getHightlightCoords() {
var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
var pageRect = page.canvas.getClientRects()[0];
var selectionRects = window.getSelection().getRangeAt(0).getClientRects();
var viewport = page.viewport;
var selected = selectionRects.map(function (r) {
return viewport.convertToPdfPoint(r.left - pageRect.x, r.top - pageRect.y).concat(
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
});
@meetbryce
meetbryce / avg_or_sum_array_with_js.js
Last active May 12, 2019 19:36
Average or Sum the values in an array using Javascript (and Underscore.js)
// requires Underscore.js
// uses jQuery style funciton declaration (if you aren't using jQuery, simply re-arrange the declaration)
function sum(arr) {
// returns the sum total of all values in the array
return _.reduce(arr, function(memo, num) { return memo + num}, 0);
}
function average(arr) {
// returns the average of all values in the array
@brandonmwest
brandonmwest / example.cs
Last active October 4, 2025 15:25
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 25, 2025 20:12
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@larrybotha
larrybotha / A.markdown
Last active December 4, 2025 03:24
Fix SVGs not scaling in IE9, IE10, and IE11

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.