Skip to content

Instantly share code, notes, and snippets.

@frzsombor
frzsombor / aspect-ratio-paddings.scss
Last active December 19, 2023 00:01
[SASS/SCSS] Aspect ratio padding class generator mixin
$ratios: (
4 3,
3 2,
16 9,
);
@each $x, $y in $ratios {
.aspect-ratio-padding-#{$x}-#{$y} {
padding-bottom: ($y / $x * 100%);
}
@frzsombor
frzsombor / form_deserialize.js
Last active October 17, 2019 12:33
jQuery form deserialize from serialize()-d string
//Based on: https://stackoverflow.com/a/24441276/2953830
//Few things fixed by frzsombor
$.fn.deserialize = function(serializedString) {
var $form = $(this);
$form[0].reset(); // (A) optional
serializedString = serializedString.replace(/\+/g, '%20'); // (B)
var formFieldArray = serializedString.split('&');
if (!serializedString) {
return this;
@frzsombor
frzsombor / mb_str_split.php
Created August 28, 2018 13:44 — forked from ethaizone/mb_str_split.php
mb_str_split function. multibyte version of str_split.
<?php
if (!function_exists('mb_str_split')) {
/**
* Convert a multibyte string to an array
*
* @param string $string The input string.
* @param integer $split_length Maximum length of the chunk.
* @param string $encoding The encoding parameter is the character encoding.
* @return array
@frzsombor
frzsombor / encode.sh
Created September 5, 2017 01:43 — forked from mikoim/README.md
YouTube recommended encoding settings on ffmpeg (+ libx264)
#/bin/sh
ffmpeg -i input -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low output
@frzsombor
frzsombor / gist:c907626c4e1688f9b3d4
Last active August 29, 2015 14:21
Creating and adding "localhost" SSL certification
http://superuser.com/a/74012
http://stackoverflow.com/a/15076602
- http://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate/15076602#comment44445682_15076602
Add the exported .cer to keychain
In the .cer details, set "Secure Sockets Layer (SSL)" to "Always trust"
more details coming soon
@frzsombor
frzsombor / gist:ddd0e11f93885060ef35
Last active December 7, 2023 00:05
Share Laravel's session and check authentication from external projects
<?php
/*
|--------------------------------------------------------------------------
| Sharing Laravel's session and checking authentication
|--------------------------------------------------------------------------
|
| Use the following code in any CMS (WordPress, Joomla, etc), filemanager (CKFinder,
| KCFinder, simogeos's Filemanager, etc), or any other non-Laravel project to boot into
| the Laravel framework, with session support, and check if the user is authenticated.