Skip to content

Instantly share code, notes, and snippets.

View ozrabal's full-sized avatar

Piotr Łepkowski ozrabal

View GitHub Profile
:root {
--flex-gap: 1rem; /* Variable for gap */
}
.flexbox {
display: flex;
flex-wrap: wrap;
gap: var(--flex-gap);
justify-content: center;
padding: var(--flex-gap); /* We use padding to give space between the edge of the flexbox and flex items */
@ozrabal
ozrabal / convert_yapb_images_to_post_thumbnail.php
Last active July 25, 2022 20:33
Convert yapb (Yet Another PhotoBlog Wordpress Plugin which is not anymore maintained) images to native Wordpress post feature image
<?php
function convert_yapb_images_to_post_thumbnail () {
require_once ABSPATH . 'wp-admin/includes/image.php';
global $wpdb;
$imagefileList = array();
$imageRows = $wpdb->get_results(
'SELECT id,post_id,uri FROM ' . YAPB_TABLE_NAME . ' WHERE processed<>1 ORDER BY id'
);
//$len=count($imageRows)
@ozrabal
ozrabal / flexslider_destroy.js
Created June 15, 2021 11:42 — forked from carloscabo/flexslider_destroy.js
Destroy flexslider carousel
function flexdestroy(selector) {
var $els = $(selector);
$els.each(function() {
var $el = $(this);
var $elClean = $el.clone();
$elClean.find('.flex-viewport').children().unwrap();
$elClean
@ozrabal
ozrabal / fos_user.php
Created November 12, 2020 21:06
Symfony fos user password
<?php
$salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
echo "Salt used: " . $salt ."<br/>";
echo "<br/>";
$password = 'new_password';
$salted = $password.'{'.$salt.'}';
@ozrabal
ozrabal / gist:a858c1dfefcf6bd62585abf05c6dbab1
Created November 9, 2020 14:19
Resolving missing link to libcrypto/openssl on OSX
brew uninstall --ignore-dependencies openssl
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30fd2b68feb458656c2da2b91e577960b11c42f4/Formula/openssl.rb > openssl.rb
brew install ./openssl.rb
@ozrabal
ozrabal / user.php
Created September 30, 2020 11:40
Create user in Wordpress
if (!username_exists('username')) {
$user_id = wp_create_user( 'username', 'password', 'email@email');
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
print_r($user);
}
@ozrabal
ozrabal / new-folder-from-selection.scpt
Created September 4, 2020 21:51
Create new folder from selection
tell application "Finder"
set selectedFiles to selection as alias list
set containingFolder to container of item 1 of selectedFiles
set {year:yr, month:mn, day:dy} to creation date of item 1 of selectedFiles
set convertedDate to (yr & "-" & (text -2 thru -1 of ("00" & ((mn) as integer))) & "-" & (text -2 thru -1 of ("00" & ((dy) as integer)))) as string
set theFolder to (make new folder at containingFolder with properties {name:convertedDate})
repeat with i from 1 to count of selectedFiles
set thisItem to item i of selectedFiles
move thisItem to (theFolder)
end repeat
data:[^}]+},
@ozrabal
ozrabal / devTools.js
Last active October 31, 2019 07:44
Add shortcut to open devtools in electron app on production #electron
import { remote } from 'electron'
remote.globalShortcut.register('CommandOrControl+Shift+K', () => {
remote.BrowserWindow.getFocusedWindow().webContents.openDevTools()
})
window.addEventListener('beforeunload', () => {
remote.globalShortcut.unregisterAll()
})
@ozrabal
ozrabal / log.js
Created October 1, 2019 10:04
electron log
function logEverywhere(s) {
console.log({s})
if (Window && Window.webContents) {
Window.webContents.executeJavaScript(`console.log("${s.toString()}")`)
}
}