Skip to content

Instantly share code, notes, and snippets.

what's up

Patrik Toma patotoma

what's up
Block or report user

Report or block patotoma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
patotoma / image-orientation.ts
Created May 22, 2019
Rotate image preview to compensate for EXIF orientation (Javascript / Typescript)
View image-orientation.ts
// Based on:
* Create a Base64 Image URL, with rotation applied to compensate for EXIF orientation, if needed.
* Optionally resize to a smaller maximum width - to improve performance for larger image thumbnails.
export async function getImageUrl(file: File, maxWidth?: number) {
return readOrientation(file)
.then(orientation => applyRotation(file, orientation || 1, maxWidth || 999999));
patotoma /
Last active Dec 15, 2019
Simple Asynchronous Contact Form with jQuery and PHP

Simple Ajax Contact Form with jQuery and PHP


  • index.html
  • style.css
  • js.js
  • mailer.php


patotoma /
Created Feb 22, 2014
Instant Search and Order with AngularJS

Instant Search and Order with AngularJS

How to use:

  • Download instantSearch.html or just copy the code.
  • Add the file to your webpage directory.
  • Edit to suit your needs.

Working fiddle

patotoma /
Last active Dec 1, 2019
secure php contact form

Secured PHP Contact Form

    $name = htmlspecialchars(stripslashes(trim($_POST['name'])));
    $subject = htmlspecialchars(stripslashes(trim($_POST['subject'])));
    $email = htmlspecialchars(stripslashes(trim($_POST['email'])));
    $message = htmlspecialchars(stripslashes(trim($_POST['message'])));
    if(!preg_match("/^[A-Za-z .'-]+$/", $name)){
patotoma /
Last active Aug 29, 2015
image slide show

Image Slide Show with jQuery

$.fn.slideShow = function(fadeIn, fadeOut, duration){
  var list = this;
  var ID = setInterval(function(){
    var visible = $(list).find('li:visible');
patotoma /
Last active Aug 29, 2015
Smooth Scroll with jQuery

Smooth Scroll with jQuery

$.fn.smoothscroll = function(offset, speed){
  $(this).find('a').on('click', function(e){
      $('html,body').animate({scrollTop: $(this.hash).offset().top - offset}, speed);
You can’t perform that action at this time.