Skip to content

Instantly share code, notes, and snippets.

View kstratis's full-sized avatar

Konstantinos Stratis kstratis

  • ▅▆▇
  • Athens, Greece
View GitHub Profile
@maxivak
maxivak / 00.md
Last active June 5, 2025 15:20
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@janko
janko / 01-safe-download.rb
Last active May 18, 2025 04:04
A safe way in Ruby to download a file to disk using open-uri (with/without comments)
require "open-uri"
require "net/http"
Error = Class.new(StandardError)
DOWNLOAD_ERRORS = [
SocketError,
OpenURI::HTTPError,
RuntimeError,
URI::InvalidURIError,
@B-iggy
B-iggy / inline-svg-function.scss
Last active December 13, 2020 11:53
Inline SVG function [SASS]
// set svg d path used as fallback (star)
$svg-d-path: 'm25,1l6,17l18,0l-14,11l5,17l-15,-10l-15,10l5,-17l-14,-11l18,0l6,-17z' !default;
// functions to urlencode the svg string
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
@digitalicarus
digitalicarus / fiddle.css
Last active February 2, 2021 15:15
React Animation: List Filter Animation
.super-fly-list-component .measure {
position: absolute;
left: -9999px;
}
.super-fly-list-component {
position: relative;
}
.super-fly-list-component li {
position: absolute;
transition: opacity .3s ease, transform .3s ease, top .1s ease;
@devonzuegel
devonzuegel / .pryrc
Last active September 18, 2024 04:59
My .pryrc file
# === EDITOR ===
Pry.editor = 'vi'
require 'awesome_print'
# == Pry-Nav - Using pry as a debugger ==
Pry.commands.alias_command 'c', 'continue' rescue nil
Pry.commands.alias_command 's', 'step' rescue nil
Pry.commands.alias_command 'n', 'next' rescue nil
# === CUSTOM PROMPT ===
@protrolium
protrolium / ffmpeg.md
Last active July 5, 2025 20:17
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@mxhold
mxhold / no-trailing-slashes-nginx-and-middleman.md
Last active January 21, 2019 00:10
Prevent trailing slashes in URLs with Middleman and Nginx

So you want to have pretty URLs with no trailing slash or .html like:

http://mysite.com/blog/my-new-kitten

not like:

http://mysite.com/blog/my-new-kitten/

or

@derekclee
derekclee / compressed_svg.rb
Last active March 22, 2018 14:53
Compressing static svg files for the rails asset pipeline
# I used https://github.com/eliotsykes/rack-zippy to serve gzipped static assets.
# By default the rails asset pipeline was not compressing any static svg files,
# so I did the following to achive that.
#
# First create a rake task that will fine and compress svg files.
# File: lib/tasks/assets_svg_compress.rake
namespace :assets do
task :svg_compress => :environment do
svg_files = Dir["./public/**/*.svg"]
svg_files.each do |file|
@securingsincity
securingsincity / main.jsx
Created March 24, 2015 20:08
Check all example
var React = require('react/addons');
var Table = require('./table.jsx');
var rows = [
{
'id' : 1,
'foo': 'bar'
},
{
'id' : 2,
'foo': 'baarrrr'
@nathanharper
nathanharper / default-csrf.js
Last active January 22, 2018 11:56
axios default CSRF Token
let csrfToken = 'lololololol';
let axiosDefaults = require('axios/lib/defaults');
axiosDefaults.headers.common['X-CSRF-Token'] = csrfToken;