How to Improve Design Skills
April 26, 2019
Jeffery Yuan
April 26, 2019
Jeffery Yuan
April 25, 2019
brew install git bash-completiongit config --global credential.helper 'cache --timeout 72000'git credential-osxkeychain erasegit update-index --assume-unchanged file-pathgit update-index --no-assume-unchanged file-pathgit rm --cached -r somedir/somefile then add them to .gitignoregit reset --soft HEAD~1git reset --hard HEAD~3git reset --soft commit_hashgit reset HEAD~git reset --hardgit fetch --all && git reset --hard upstream/mastergit rebase --interactive 'bbc643cd^'
# change pick to edit, Make your changes and then commit them with the same message
git commit --all --amend --no-edit
git rebase --continuegit rebase -i <oldsha1>
# mark the expected commit as `edit` (replace pick in front of the line), save and close
git reset HEAD^
git add ...
git commit -m "First part"
git add ...
git commit -m "Second part"
git rebase --continuegit rebase --onto <branch name>~<first commit number to remove> <branch name>~<first commit to be kept> <branch name>
# e.g to remove commits 2 & 3
git rebase --onto repair~3 repair~1 repairgit branch -d <local_branchname>git push origin --delete <remote_branchname> or git push origin :<remote_branchname>git branch -m <new-branch-name>git clone --depth 1 https://path/to/repo/foo.git -b bargit ls-remote --tags remote_git_url
git clean -x -d -fgit commit --amend<type>(<scope>): <subject>git remotegit remote add upstream the_urlgit remote showgit remote show upstreamgit stash listgit stashgit stash -ugit stash apply <stash@{n}>git stash popgit stash cleargit checkout <stash@{n}> -- <filePath>git diff -wgit diff --cachedgit diff origin/master..mastergit whatchanged --since='1 weeks ago'git status -uno(--untracked-files=no)git stash clearSometimes we want to copy some text/code from a website, but find out that it disables copy text or even completely disables right click, right context menu. It’s annoying, but we can fix it easily.
We can use the following Specific Chrome extensions to make us able to copy text.
If we don’t want to install the above specific Chrome extensions, then we can use the more general reader view chrome extension which can also make us able to copy text.
Read here for more must-have google chrome extensions
The Great Suspender: the page in reader view will not be suspended as it runs in extension mode.Ctrl+Shift+R to Toggle the Reader Viewtext-to-speechCtrl+Shift+R to enter reader view:Ctrl+l then Ctrl+c or yy from Chrome VimiumCmd+down to scroll to the end of page first to make sure the page load completes.Ctrl+Shift+L to Open the Just Read format for the current pageCtrl+Shift+K to Enable user text selection mode using Just Read, then choose which part you want to select then enter (it will automatically try best to choose), it will show the section in read mode.View this selection in Just Read.Ctrl+Shift+C to Toggle Clearlynot easy to copy text easier to copyAmazon Affiliate Program provides different kinds of ads.
Custom Ads allows us to curate specific products from Amazon that you would like to recommend and place the ad unit into your webpage. All we need is find a list ASINs of products and add them into amzn_assoc_asins.
<script type="text/javascript">
amzn_assoc_placement = "adunit0";
amzn_assoc_search_bar = "false";
amzn_assoc_tracking_id = "the_tracking_id";
amzn_assoc_ad_mode = "manual";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "Best books for algorithms interview";
amzn_assoc_linkid = "the_amzn_assoc_linkid";
amzn_assoc_asins = "0984782850,1517671272,1617292230,032157351X,1537713949,0262033844,111941847X,819324527X";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>
<div id="amzn-assoc-ad-19c89cc6-6f8f-485d-a31a-7bc49e98e831"></div><script async src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=19c89cc6-6f8f-485d-a31a-7bc49e98e831"></script>Display search results from Amazon.com by specifying a search phrase and selecting a relevant category to your page content in a responsive ad unit that works across screen sizes.
We can specify a list of search phrases and sort them by priority, random pick one search phrase and stick to it in the X(10) days.
<script type="text/javascript">
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
} else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == " ") c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function deleteCookie(name, path, domain) {
if (readCookie(name)) createCookie(name, "", -1, path, domain);
}
function pickOne(weightedPosts) {
var totalWeight = 0;
for (let post of weightedPosts) {
totalWeight += post.weight;
}
var randomWeight = Math.random() * totalWeight;
var currWeight = 0;
for (let post of weightedPosts) {
currWeight += post.weight;
if (currWeight > randomWeight) {
return post;
}
}
}
</script>
<script type="text/javascript">
var pos = readCookie("amazonItemPos")
var products = Array("iphone", "iPad Pro", "iPad Mini", "apple watch series 4", "MacBook Pro", "MacBook Air", "google pixel 3", "chromebook", "Amazon Echo");
var items = new Set();
var totalCount = products.length;
for (var i = 0; i < products.length; i++) {
items.add(
{
product: products[i],
weight: totalCount - i,
pos: i
}
);
}
// var item = items[Math.floor(Math.random() * items.length)];
if (pos == null || pos <0 || pos > products.length) {
// pos = Math.floor(Math.random() * items.length);
pos = pickOne(items).pos
createCookie("amazonItemPos", pos, 10);
}
var item = products[pos];
amzn_assoc_placement = "adunit3";
amzn_assoc_search_bar = "true";
amzn_assoc_tracking_id = "the_tracking_id";
amzn_assoc_search_bar_position = "bottom";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_title = "";
amzn_assoc_default_search_phrase = item;
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "the_amzn_assoc_linkid";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US"></script>I Would like to change the speed of HTML5 video player at pan.baidu.com, so I can spend less time on the video and finish it sooner.
I found some user script at greasyfork for Chrome with tampermonkey extension
Based on these 2 script, I made the following simple user script that can change video speed to 1.5, 1.75, 2.0.
// ==UserScript==
// @name Change speed at pan.baidu
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Add button to change to 1.5, 1.76, 2X speed
// @author Jeffery Yuan
// @match *://*.pan.baidu.com/*
// @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// ==/UserScript==
(function() {
'use strict';
var $ = $ || window.$;
function addSpeedButton(parentNode, speed){
var cb = document.createElement("a");
cb.innerHTML='<a class="g-button" href="javascript:;" title="' + speed + '">'+
'<span class="g-button-right">'+
'<em class="icon icon-appeal" title="' + speed +'"></em>'+
'<span id="fps" class="text" style="width: auto;">' + speed + '</span></span></a>'
cb.onclick=function(){
videojs.getPlayers("video-player").html5player.tech_.setPlaybackRate(speed);
};
parentNode.after(cb);
}
// var tb = document.getElementsByClassName("g-button")[1];
var elms = document.getElementsByClassName("g-button");
var toolbar = elms[0].parentNode;
toolbar.removeChild(elms[1]);
toolbar.removeChild(elms[1]);
toolbar.removeChild(elms[1]);
var tb = elms[0];
addSpeedButton(tb, 2.0)
addSpeedButton(tb, 1.75)
addSpeedButton(tb, 1.5)
addSpeedButton(tb, 1)
})();Preserve Last Search for Command Palette and Fuzzy FinderShift+>(<) to increase/decrease speed in Youtubevideojs.getPlayers("video-player").html5player.tech_.setPlaybackRate(2)X movie in 10 minutes etcdelete.sh && build.sh && deploy.shSchedule Send