Skip to content

Instantly share code, notes, and snippets.

View swistaczek's full-sized avatar

Ernest Bursa swistaczek

View GitHub Profile
@swistaczek
swistaczek / index.js
Created September 5, 2023 12:38
Google Cloud Functions: Strip exif from image files when added to Google Cloud Storage
const functions = require('@google-cloud/functions-framework');
const { Storage } = require('@google-cloud/storage');
const ExifTransformer = require('exif-be-gone');
const stream = require('stream');
const util = require('util');
const storage = new Storage();
const pipeline = util.promisify(stream.pipeline);
@swistaczek
swistaczek / BackendCodingChallenge_README.md
Created June 20, 2023 10:07 — forked from wbaumann/BackendCodingChallenge_README.md
A challenge for designing a backend app

Backend Coding Challenge

Hi 👋! Thank you for taking the time to participate in this coding challenge to develop a backend service. The following task is going to show us your skills, experience and coding style. Please remember that you can use as many tools as you feel comfortable with.

What to expect?

We expect that it will take 3-8 hours to complete this exercise. While you're welcome to take as much extra time as you'd like to clean up or improve the codebase, it's not required. If there's something that you would have done in a "real" production environment, feel free to add details to your README, so we can better understand what next steps that you'd take.

Challenge

@swistaczek
swistaczek / Mac OSX Setup - Brew
Created January 4, 2019 13:26 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
require 'stilts-stomp-client'
require 'json'
client = Stilts::Stomp::Client.new("localhost:8675")
client.connect
# Using headers due to missing TorqueBox stomp username and password functionality
headers = org.projectodd.stilts.stomp::DefaultHeaders.new
headers.putAll({ 'api_key' => 'tpG8jY1SnbSeQvS9Ip2dhQ' })
@swistaczek
swistaczek / simple_cipher.rb
Created October 14, 2012 12:29
SimpleCipher
# encoding: utf-8
class SimpleCipher
def initialize(randomized)
alphasum = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + [' ']
@map = alphasum.zip(randomized).inject(:encrypt => {} , :decrypt => {}) do |output,(a,b)|
output[:encrypt][a] = b
output[:decrypt][b] = a
output
end
@swistaczek
swistaczek / url_helper.rb
Created September 1, 2012 12:42
Create helper for :subdomain in Rails 3
# -*- encoding : utf-8 -*-
module UrlHelper
def with_subdomain(subdomain)
subdomain = (subdomain || "")
subdomain += "." unless subdomain.empty?
domain_woport = request.domain.gsub(/:{1}\d*/, '')
[subdomain, request.domain].join #request.port_string
end
def url_for(options = nil)
@swistaczek
swistaczek / warsztaty.md
Created April 20, 2012 17:26
Warsztaty Atena RubyOnRails

Wprowadzenie do Ruby on Rails

Ernest Bursa dla SKN Atena.

stworzenie nowego projektu

rails new euro2012
cd euro2012/

pobranie szkieletu

@swistaczek
swistaczek / loseless_reduce.rb
Created June 20, 2011 08:38
Reduce Paperclip processor (loseless opt js, css, jpg, png or gif files)
#lib/paperclip_processors/loseless_reduce.rb
require 'reduce'
## LoseLessReduce
# This module is able to reduce js, css, jpg, png or gif files
# thanks to gem reduce by grosser (via yui compressor or punnyPng)
# https://github.com/grosser/reduce
module Paperclip
class LoselessReduce < Processor