Skip to content

Instantly share code, notes, and snippets.

View niladam's full-sized avatar

Madalin Tache niladam

View GitHub Profile
<?php
namespace App\Helper;
trait WpTrait
{
/**
* Replaces double line-breaks with paragraph elements.
@niladam
niladam / romanian-cif-validate.js
Created May 30, 2023 07:15 — forked from brokenthorn/romanian-cif-validate.js
Functie Javascript pentru validarea CIF (Cod Identificare Fiscala) / CUI (Cod Unic Identificare)
/**
* Validates if a string conforms to a valid Romanian Fiscal Code.
*
* See Romanian Law no. 359 from 8 September 2004.
* @param v {string} input string to be validated
* @returns {string|boolean} `true` if the input is a valid CIF or an error message,
* describing where validation failed
*/
function validateRomanianCIF (v) {
if (typeof v !== 'string') {
exiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" "-FileCreateDate<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json .
@niladam
niladam / nginx-webp-sample.conf
Created March 6, 2023 13:00 — forked from uhop/nginx-webp-sample.conf
Serving WEBP with nginx conditionally.
user www-data;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
@niladam
niladam / inc-remove-comments.php
Created December 20, 2016 12:01 — forked from functionsfile/inc-remove-comments.php
Remove WordPress comments functionality.
<?php
/**
* Code taken from the plugin 'Remove Comments Absolutely' by Frank Bültge
* http://wpengineer.com/2230/removing-comments-absolutely-wordpress/
* https://github.com/bueltge/Remove-Comments-Absolutely/blob/master/remove-comments-absolute.php
* http://bueltge.de/
*/
if ( ! class_exists( 'Remove_Comments_Absolute' ) ) {
add_action( 'plugins_loaded', array( 'Remove_Comments_Absolute', 'get_object' ) );
@niladam
niladam / TransmitOpenTerminal.txt
Created October 24, 2017 13:39 — forked from johnfmorton/TransmitOpenTerminal.txt
Use Transmit 5 to open in iTerm (instead of Terminal.app) as mentioned here https://library.panic.com/transmit5/open-in-terminal/
on openTerminal(location, remoteHost, serverPort)
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
tell application "iTerm"
activate
set targetTab to ""
@niladam
niladam / CreateBarCode.php
Created May 20, 2022 07:01 — forked from kaystrobach/CreateBarCode.php
Convert UUIDs into BigInt with ramsey/uuid
<?php
// needs picqer/php-barcode-generator
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
$barcode = $generator->getBarcode($data, $generator::TYPE_CODE_128, 3, 100, [0,0,0]);
// ensure the char count is even for CODE_128_C
$barcodeData = (strlen($data) % 2) === 0 ? $data : '0' . $data;
$generator = new \Picqer\Barcode\BarcodeGeneratorPNG();
@niladam
niladam / box-shadow.html
Created October 22, 2020 12:47 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@niladam
niladam / mv.sh
Created April 19, 2020 12:22 — forked from premek/mv.sh
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@niladam
niladam / generate-ssh-key.sh
Created March 22, 2020 09:54 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa