git reset --soft HEAD~1
/** | |
* The module pattern | |
*/ | |
const myObject = (function(){ // "const" is like "var" but cannot change | |
const myName = 'Kostas'; // This is private | |
const mySurname = 'Kapenekakis'; // This is private too | |
const sayFullName = function () { | |
alert(myName + ' ' + mySurname); | |
} | |
Bookmarklet: [🍪]("javascript:(function(){window.biscuit=(()=>({getCookie: cookieName => document.cookie.split(';').map(item=>item.split('=').map(name=>name.trim())).map(item=>({name: item[0], value: item[1]})).find(item => item.name === cookieName), setCookie: (cookieName, cookieValue) => document.cookie = ${cookieName}=${cookieValue}
}))(); })();")
Create an ssh key:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Start the ssh-agent in the background:
function get_pull_request_url () { | |
local GIT_BRANCH_NAME=$(git symbolic-ref --short HEAD); | |
local GIT_REMOTE_URL=$(git config --get remote.origin.url); | |
# [email protected]:USER_NAME/REPO_NAME.git | |
local GIT_FULL_REMOTE_NAME=$(echo $GIT_REMOTE_URL | sed -e 's/[email protected]://' -e 's/\.git//'); | |
# https://github.com/ORG_NAME/REPO_NAME/compare/GIT_BRANCH_NAME?expand=1 | |
echo "https://github.com/${GIT_FULL_REMOTE_NAME}/compare/${GIT_BRANCH_NAME}?expand=1" | |
} |
Well, since the time I started playing with node.js and express I wondered how a router works under the hood. I even remember I once had a look on Backbone's router and didn't seem too hard to understand, but was wondering who is that crazy person who came up with this.
A couple days ago I wanted to build a simple markdown-notes list for fun using react. I started with a list of notes where you click one and navigate to the single note view. Ok, first I need to install React Router... Nah. That's boring. I'll just make a dummy router for now. How hard can it be? Let's see.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Building a router</title> | |
<script> | |
// Put John's template engine code here... | |
(function () { | |
// A hash to store our routes: |