Skip to content

Instantly share code, notes, and snippets.

View makubexD's full-sized avatar
🏠
Working from home

makubexD

🏠
Working from home
View GitHub Profile
@makubexD
makubexD / Instructions.md
Created October 18, 2021 22:39 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

@makubexD
makubexD / pre-commit
Created July 16, 2021 00:46 — forked from posquit0/pre-commit
Git Pre Commit Hook for ESLint and Jest
#!/usr/bin/env bash
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.jsx\?$')
BIN_PATH="$(git rev-parse --show-toplevel)/node_modules/.bin"
eslint() {
ESLINT="$BIN_PATH/eslint"
# Check for eslint
@makubexD
makubexD / sendemailsasync.cs
Created October 9, 2019 19:45
Sending multiple emails in parallel using SmtpClient.SendMailAsync with async and Task.WhenAll
var sendEmailTasks = recipientList.Select(async recipient =>
{
var message = new MailMessage { To = { recipient }, ... };
// instantiate a new client for each mail because of this:
// http://www.codefrenzy.net/2012/01/30/how-asynchronous-is-smtpclient-sendasync/
using (var smtpClient = new SmtpClient())
{
await smtpClient.SendMailAsync(message);
}
@makubexD
makubexD / GeoLocation.js
Created April 30, 2018 20:54 — forked from ederoyd46/GeoLocation.js
Javascript for finding latitude and longitude range boundaries
//Javascript for finding latitude and longitude range boundaries.
//Based on the excellent Java example by http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
var GeoLocation = GeoLocation ? GeoLocation : {
TO_RADIAN: 0.0174532925,
TO_DEGREE: 57.2957795,
EARTH_RADIUS: 6371.01,
TO_MILE: 0.621371192,
TO_KM: 1.609344,
MIN_LAT: function() { return GeoLocation.degreeToRadian(-90) },