This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataOld = ...; | |
var dataNew = dataOld.replace(/[^0123456789aąbcćdeęfghijklłmnńoópqrsśtuvwxyzźżAĄBCĆDEĘFGHIJKLŁMNŃOÓPQRSŚTUVWXYZŹŻ\ \!\"\#\$\%\&\'\(\)\+\,\.\/\:\;\<\=\>\?\@\[\]\_\`\{\|\}\–\—\‘\’\‚\“\”\„\…\-]/g, ''); | |
return dataNew; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataOld = 'asdasdasdasdasdasdasda'; | |
const dataNew = [...new Set(dataOld)].join('') | |
// 'asd' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
fs.readFile("file-with-emoji.txt", "utf-8", (err, data) => { | |
var dataOld = data | |
var dataNew = dataOld.replace(/[^0123456789aąbcćdeęfghijklłmnńoópqrsśtuvwxyzźżAĄBCĆDEĘFGHIJKLŁMNŃOÓPQRSŚTUVWXYZŹŻ\ \!\"\#\$\%\&\'\(\)\+\,\.\/\:\;\<\=\>\?\@\[\]\_\`\{\|\}\–\—\‘\’\‚\“\”\„\…\-]/g, ''); | |
fs.writeFile("file-without-emoji.txt", dataNew, (err) => { | |
console.log("Successfully Written to File."); | |
}); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Applications/MAMP/Library/bin/mysql -uroot -proot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update_admin_email() { | |
global $wpdb; | |
$wpdb->query("UPDATE `wp_options` SET `option_value` = 'admin@test.local' WHERE `option_name` = 'admin_email'"); | |
} | |
add_action('init', 'update_admin_email'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = { | |
online_rate_1: "$5.00", | |
online_rate_2: "$22.00", | |
online_rate_3: "$44.00", | |
rate_1: "$9.00", | |
rate_2: "$18.00", | |
rate_3: "$30.00", | |
rate_description: "<p>Some description text</p>", | |
time_period_1: "0 - 0.5 Hours", | |
time_period_2: "0.5 - 1 Hours", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command Line Bash - Change file date modified to date taken/created - For each file in directory - Linux/Mac | |
# 1. Best method, find file with .jpg extension, and do function: | |
find . -iname \*.jpg -exec sh -c 'for f in "$@";do m="$(GetFileInfo -d "$f")";SetFile -m "$m" -d "$m" "$f";done' sh {} + | |
# 2. My old method - Example with all files in current directory: | |
for f in $(ls .);do touch -t $(date -r $(stat -f%B $f) +%Y%m%d%H%M) $f;done | |
# 3. My old method - Example with all files in specific directory: | |
# specific directory is for example: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// without seconds (YEAR, MONTH, DAY, HOUR, MIN): | |
touch -t 201904191556 image.jpg | |
// with seconds (YEAR, MONTH, DAY, HOUR, MIN.SECONDS): | |
touch -t 201904191556.12 image.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add in head section - for fastest loading, before scripts and styles. | |
<style type="text/css">body{overflow:hidden;pointer-events:none;opacity:0;transition:opacity 2s;-webkit-transition:opacity 2s;}</style> | |
<script type="text/javascript">window.onload=function(){document.body.setAttribute("style","overflow:initial;opacity:1;pointer-events:initial;");}</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// show changed files in only last one commit: | |
git diff --name-only HEAD~1..HEAD | |
// show changed files in 4 last commits: | |
git diff --name-only HEAD~4..HEAD |