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
# For Sony cameras, the date format for the folders is defined in https://helpguide.sony.net/ilc/1710/v1/en/contents/TP0001629784.html | |
# Here I convert it to yyyy-mm-dd | |
for dir in */; do | |
mv $dir "202${dir:3:1}-${dir:4:2}-${dir:6:2}" | |
done |
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 $ = (selector, startNode) => (startNode || document).querySelector(selector); | |
var $$ = (selector, startNode) => Array.from((startNode || document).querySelectorAll(selector)); | |
var all = $$('.sixersoffers__container').map(x => { | |
return { name: $('img', x).attributes['alt'].value, offer: $('.sixerscontent-one', x).textContent, daysLeft: $('.sixerscontent-two', x).textContent, elem: x } | |
}) | |
var interested = ['Best Buy', 'Starbucks', 'CVS', "McDonald's", "DoorDash", "Holiday Inn", "Under Armour", "Rite Aid", "Hyatt", "Tommy Hilfiger", "Office Depot", "Sam's Club", "Kohl"] | |
var format = (x) => x.map(x => `${x.name}\t${x.offer}\t${x.daysLeft}`).join('\n') | |
var filtered = all.filter(x => interested.some(i => x.name.toLowerCase().includes(i.toLowerCase()))) | |
all.forEach(x => x.elem.style.border = '') | |
filtered.forEach(x => x.elem.style.border = 'solid 3px red') |
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
Array.prototype.getUnique = function() { | |
var o = {}, a = [] | |
for (var i = 0; i < this.length; i++) { | |
if (o[this[i]]) continue; | |
o[this[i]] = 1; | |
a.push(this[i]); | |
} | |
return a | |
} |
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 copy(str) { | |
// Chrome Console API is not available :( Have to use this way. | |
const el = document.createElement("textarea"); | |
el.value = str; | |
el.setAttribute("readonly", ""); | |
el.style.position = "absolute"; | |
el.style.left = "-9999px"; | |
document.body.appendChild(el); | |
el.select(); | |
document.execCommand("copy"); |
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
// 1. Go to Github Branches Page | |
// 2. Open Chrome Dev Tool Console (F12) | |
// 3. Paste this command into the console and run. | |
// 4. Paste your clipboard in bash command line and run. | |
copy('git push origin --delete ' + $$('a.branch-name').map(x => x.textContent).join(' ')) |
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
use admin | |
files = ls(); | |
files.forEach((file) => { | |
regex=/\.\/(.*)\.md/g | |
parts=regex.exec(file) | |
if (parts == null) return | |
title=parts[1] | |
print(title) | |
content=cat(file) | |
print(content) |
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
.droplet { | |
width: 1em; | |
height: 1em; | |
border-radius: 80% 0 55% 50% / 55% 0 80% 50%; | |
background-color: #07C; | |
transform: rotate(-45deg); | |
} |
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
$.fn.pureCss = function (css) { | |
var $dummy = this.parent().clone().appendTo('body').hide(); | |
var ret = $dummy.find(this.selector).css(css); | |
$dummy.remove(); | |
return ret; | |
}; |
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
// http://codepen.io/lzl124631x/pen/xOmJGE | |
$.fn.keepRatio = function(ratio) { | |
var self = this, | |
$p = this.parent(), | |
keep = function() { | |
var w = $p.width(), | |
h = $p.height(); | |
if (w / h > ratio) { | |
self.height(h); | |
self.width(h * ratio); |
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
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"> |
NewerOlder